AndrewMayesPrezzee
commited on
Commit
·
f7451e7
1
Parent(s):
9d44f43
Readme Updated
Browse files
README.md
CHANGED
@@ -25,26 +25,27 @@ If you want to use the implementation directly from the Hub code repository (wit
|
|
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
|
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 |
-
|
47 |
-
print("
|
48 |
```
|
49 |
|
50 |
## 🚀 Features
|
|
|
25 |
from huggingface_hub import snapshot_download
|
26 |
import sys, torch
|
27 |
|
28 |
+
# 1) Download the code+weights for your repo “as is”
|
29 |
repo_dir = snapshot_download(
|
30 |
+
repo_id="amaye15/autoencoder",
|
31 |
repo_type="model",
|
32 |
+
allow_patterns=["*.py", "config.json", "*.safetensors"], # note the * wildcards
|
33 |
)
|
34 |
+
|
35 |
+
# 2) Add to import path so plain imports work
|
36 |
sys.path.append(repo_dir)
|
37 |
|
38 |
+
# 3) Import your classes from the repo code
|
39 |
from configuration_autoencoder import AutoencoderConfig
|
40 |
from modeling_autoencoder import AutoencoderForReconstruction
|
41 |
|
42 |
+
# 4) Load the placeholder weights from the local folder (no internet, no code refresh)
|
43 |
+
model = AutoencoderForReconstruction.from_pretrained(repo_dir)
|
|
|
|
|
|
|
44 |
|
45 |
+
# 5) Quick smoke test
|
46 |
x = torch.randn(8, 20)
|
47 |
+
out = model(input_values=x)
|
48 |
+
print("latent:", out.last_hidden_state.shape, "reconstructed:", out.reconstructed.shape)
|
49 |
```
|
50 |
|
51 |
## 🚀 Features
|