Spaces:
Runtime error
Runtime error
Update init_model.py
Browse files- init_model.py +9 -7
init_model.py
CHANGED
@@ -3,8 +3,15 @@ from transformers import BertTokenizer
|
|
3 |
from evo_model import EvoTransformerConfig, EvoTransformerForClassification
|
4 |
|
5 |
def initialize_and_save_model():
|
6 |
-
# Step 1: Initialize configuration
|
7 |
-
config = EvoTransformerConfig(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
# Step 2: Initialize model
|
10 |
model = EvoTransformerForClassification(config)
|
@@ -19,10 +26,5 @@ def initialize_and_save_model():
|
|
19 |
|
20 |
print("β
EvoTransformer and tokenizer initialized and saved to 'trained_model/'")
|
21 |
|
22 |
-
def load_model():
|
23 |
-
model = EvoTransformerForClassification.from_pretrained("trained_model")
|
24 |
-
return model
|
25 |
-
|
26 |
-
# Optional: reinitialize if run directly
|
27 |
if __name__ == "__main__":
|
28 |
initialize_and_save_model()
|
|
|
3 |
from evo_model import EvoTransformerConfig, EvoTransformerForClassification
|
4 |
|
5 |
def initialize_and_save_model():
|
6 |
+
# Step 1: Initialize configuration with architecture info
|
7 |
+
config = EvoTransformerConfig(
|
8 |
+
hidden_size=384,
|
9 |
+
num_layers=6,
|
10 |
+
num_labels=2,
|
11 |
+
num_heads=6,
|
12 |
+
ffn_dim=1024,
|
13 |
+
use_memory=False
|
14 |
+
)
|
15 |
|
16 |
# Step 2: Initialize model
|
17 |
model = EvoTransformerForClassification(config)
|
|
|
26 |
|
27 |
print("β
EvoTransformer and tokenizer initialized and saved to 'trained_model/'")
|
28 |
|
|
|
|
|
|
|
|
|
|
|
29 |
if __name__ == "__main__":
|
30 |
initialize_and_save_model()
|