Create save_model.py
Browse files- save_model.py +14 -0
save_model.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Run this once on your machine to generate the weight files
|
| 2 |
+
import torch
|
| 3 |
+
from modeling_recursive_transformer import RecursiveTransformerConfig, RecursiveTransformerModel
|
| 4 |
+
|
| 5 |
+
config = RecursiveTransformerConfig()
|
| 6 |
+
model = RecursiveTransformerModel(config)
|
| 7 |
+
|
| 8 |
+
# Add a couple of example memory blocks
|
| 9 |
+
model.add_memory("Paris is the capital of France")
|
| 10 |
+
model.add_memory("The Eiffel Tower is in Paris")
|
| 11 |
+
|
| 12 |
+
# Save everything
|
| 13 |
+
model.save_pretrained("./")
|
| 14 |
+
print("✅ pytorch_model.bin and memory_state.json created!")
|