Upload AutoEncoder
Browse files- config.json +1 -1
- model.safetensors +1 -1
- modeling_autoencoder.py +24 -1
config.json
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
"AutoEncoder"
|
4 |
],
|
5 |
"auto_map": {
|
6 |
-
"AutoConfig": "
|
7 |
"AutoModel": "modeling_autoencoder.AutoEncoder"
|
8 |
},
|
9 |
"compression_rate": 0.5,
|
|
|
3 |
"AutoEncoder"
|
4 |
],
|
5 |
"auto_map": {
|
6 |
+
"AutoConfig": "modeling_autoencoder.AutoEncoderConfig",
|
7 |
"AutoModel": "modeling_autoencoder.AutoEncoder"
|
8 |
},
|
9 |
"compression_rate": 0.5,
|
model.safetensors
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 7348552
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0843a9219f8207ea933b09d69c8fd229ed196f2427634d4a250e313c2e7cb790
|
3 |
size 7348552
|
modeling_autoencoder.py
CHANGED
@@ -1,12 +1,35 @@
|
|
1 |
|
2 |
from torch import nn
|
3 |
|
4 |
-
from autoencoder_model.configuration_autoencoder import AutoEncoderConfig
|
|
|
|
|
5 |
|
6 |
|
7 |
from transformers import PretrainedConfig, PreTrainedModel
|
8 |
|
|
|
|
|
|
|
|
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
def create_layers(model_section, layer_types, input_dim, latent_dim, num_layers, dropout_rate, compression_rate):
|
12 |
|
|
|
1 |
|
2 |
from torch import nn
|
3 |
|
4 |
+
#from autoencoder_model.configuration_autoencoder import AutoEncoderConfig
|
5 |
+
|
6 |
+
|
7 |
|
8 |
|
9 |
from transformers import PretrainedConfig, PreTrainedModel
|
10 |
|
11 |
+
from transformers import PretrainedConfig
|
12 |
+
|
13 |
+
class AutoEncoderConfig(PretrainedConfig):
|
14 |
+
model_type = "autoencoder"
|
15 |
|
16 |
+
def __init__(
|
17 |
+
self,
|
18 |
+
input_dim=None,
|
19 |
+
latent_dim=None,
|
20 |
+
layer_types=None,
|
21 |
+
dropout_rate=None,
|
22 |
+
num_layers=None,
|
23 |
+
compression_rate=None,
|
24 |
+
**kwargs
|
25 |
+
):
|
26 |
+
super().__init__(**kwargs)
|
27 |
+
self.input_dim = input_dim
|
28 |
+
self.latent_dim = latent_dim
|
29 |
+
self.layer_types = layer_types
|
30 |
+
self.dropout_rate = dropout_rate
|
31 |
+
self.num_layers = num_layers
|
32 |
+
self.compression_rate = compression_rate
|
33 |
|
34 |
def create_layers(model_section, layer_types, input_dim, latent_dim, num_layers, dropout_rate, compression_rate):
|
35 |
|