Create test.py
Browse files
test.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
import torch
|
| 3 |
+
from model import AcoliModel
|
| 4 |
+
import json
|
| 5 |
+
|
| 6 |
+
def test_model():
|
| 7 |
+
# Load your trained model
|
| 8 |
+
print("Loading Acoli model...")
|
| 9 |
+
model = AcoliModel("./acoli-model") # Path to your trained model
|
| 10 |
+
|
| 11 |
+
# Test with some sample Acoli text
|
| 12 |
+
test_texts = [
|
| 13 |
+
"Acoli dwog ma con gi twero nwongo piny i ceng lok.",
|
| 14 |
+
"Lapwony opoto i kom yat ma opore i wi dogola.",
|
| 15 |
+
"Pii ma okelo ngom ma tye ka dwaro lweny i kom dano.",
|
| 16 |
+
"Kit ma gitye ka twero bedo ki dano ma opore i wi piny."
|
| 17 |
+
]
|
| 18 |
+
|
| 19 |
+
print("\n=== Testing Acoli Model ===")
|
| 20 |
+
for i, text in enumerate(test_texts, 1):
|
| 21 |
+
print(f"\nTest {i}:")
|
| 22 |
+
print(f"Input: {text}")
|
| 23 |
+
prediction = model.predict(text)
|
| 24 |
+
print(f"Prediction: {prediction}")
|
| 25 |
+
|
| 26 |
+
# Get model info
|
| 27 |
+
print(f"\n=== Model Information ===")
|
| 28 |
+
info = model.get_model_info()
|
| 29 |
+
print(f"Model type: {info['model_type']}")
|
| 30 |
+
print(f"Number of parameters: {info['num_parameters']:,}")
|
| 31 |
+
print(f"Model path: {info['model_path']}")
|
| 32 |
+
|
| 33 |
+
if __name__ == "__main__":
|
| 34 |
+
test_model()
|