AndrewMayesPrezzee
commited on
Commit
·
9d44f43
1
Parent(s):
5eda1f5
Feat - Install
Browse files- README.md +32 -0
- config.json +37 -0
- model.safetensors +0 -0
README.md
CHANGED
|
@@ -16,6 +16,37 @@ tags:
|
|
| 16 |
|
| 17 |
A complete autoencoder implementation that integrates seamlessly with the Hugging Face Transformers ecosystem, providing all the standard functionality you expect from transformer models.
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
## 🚀 Features
|
| 20 |
|
| 21 |
- **Full Hugging Face Integration**: Compatible with `AutoModel`, `AutoConfig`, and `AutoTokenizer` patterns
|
|
@@ -86,6 +117,7 @@ print(f"Latent shape: {outputs.last_hidden_state.shape}")
|
|
| 86 |
print(f"Reconstructed shape: {outputs.reconstructed.shape}")
|
| 87 |
```
|
| 88 |
|
|
|
|
| 89 |
### Training with Hugging Face Trainer
|
| 90 |
|
| 91 |
```python
|
|
|
|
| 16 |
|
| 17 |
A complete autoencoder implementation that integrates seamlessly with the Hugging Face Transformers ecosystem, providing all the standard functionality you expect from transformer models.
|
| 18 |
|
| 19 |
+
|
| 20 |
+
### Install-and-Use from the Hub (code repo)
|
| 21 |
+
|
| 22 |
+
If you want to use the implementation directly from the Hub code repository (without a packaged pip install), you can download the repo and add it to `sys.path`:
|
| 23 |
+
|
| 24 |
+
```python
|
| 25 |
+
from huggingface_hub import snapshot_download
|
| 26 |
+
import sys, torch
|
| 27 |
+
|
| 28 |
+
repo_dir = snapshot_download(
|
| 29 |
+
"amaye15/autoencoder",
|
| 30 |
+
repo_type="model",
|
| 31 |
+
allow_patterns=["*.py", "config.json", "*.safetensors"],
|
| 32 |
+
)
|
| 33 |
+
sys.path.append(repo_dir)
|
| 34 |
+
|
| 35 |
+
from configuration_autoencoder import AutoencoderConfig
|
| 36 |
+
from modeling_autoencoder import AutoencoderForReconstruction
|
| 37 |
+
|
| 38 |
+
# Load placeholder weights from the same repo (or your own trained weights)
|
| 39 |
+
model = AutoencoderForReconstruction.from_pretrained(
|
| 40 |
+
"amaye15/autoencoder",
|
| 41 |
+
trust_remote_code=True,
|
| 42 |
+
)
|
| 43 |
+
|
| 44 |
+
# Quick smoke test
|
| 45 |
+
x = torch.randn(8, 20)
|
| 46 |
+
outputs = model(input_values=x)
|
| 47 |
+
print("Reconstructed:", tuple(outputs.reconstructed.shape), "Latent:", tuple(outputs.last_hidden_state.shape))
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
## 🚀 Features
|
| 51 |
|
| 52 |
- **Full Hugging Face Integration**: Compatible with `AutoModel`, `AutoConfig`, and `AutoTokenizer` patterns
|
|
|
|
| 117 |
print(f"Reconstructed shape: {outputs.reconstructed.shape}")
|
| 118 |
```
|
| 119 |
|
| 120 |
+
|
| 121 |
### Training with Hugging Face Trainer
|
| 122 |
|
| 123 |
```python
|
config.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"activation": "gelu",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"AutoencoderForReconstruction"
|
| 5 |
+
],
|
| 6 |
+
"auto_map": {
|
| 7 |
+
"AutoConfig": "configuration_autoencoder.AutoencoderConfig",
|
| 8 |
+
"AutoModel": "modeling_autoencoder.AutoencoderForReconstruction"
|
| 9 |
+
},
|
| 10 |
+
"autoencoder_type": "classic",
|
| 11 |
+
"beta": 1.0,
|
| 12 |
+
"bidirectional": true,
|
| 13 |
+
"dropout_rate": 0.1,
|
| 14 |
+
"flow_coupling_layers": 2,
|
| 15 |
+
"hidden_dims": [
|
| 16 |
+
16,
|
| 17 |
+
12
|
| 18 |
+
],
|
| 19 |
+
"input_dim": 20,
|
| 20 |
+
"latent_dim": 8,
|
| 21 |
+
"learn_inverse_preprocessing": true,
|
| 22 |
+
"model_type": "autoencoder",
|
| 23 |
+
"noise_factor": 0.1,
|
| 24 |
+
"num_layers": 2,
|
| 25 |
+
"preprocessing_hidden_dim": 32,
|
| 26 |
+
"preprocessing_num_layers": 2,
|
| 27 |
+
"preprocessing_type": "robust_scaler",
|
| 28 |
+
"reconstruction_loss": "mse",
|
| 29 |
+
"rnn_type": "lstm",
|
| 30 |
+
"sequence_length": null,
|
| 31 |
+
"teacher_forcing_ratio": 0.5,
|
| 32 |
+
"tie_weights": false,
|
| 33 |
+
"torch_dtype": "float32",
|
| 34 |
+
"transformers_version": "4.55.2",
|
| 35 |
+
"use_batch_norm": true,
|
| 36 |
+
"use_learnable_preprocessing": true
|
| 37 |
+
}
|
model.safetensors
ADDED
|
Binary file (30.7 kB). View file
|
|
|