Upload run_tests.py with huggingface_hub
Browse files- run_tests.py +12 -0
run_tests.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
from dispatchai import load_model
|
| 3 |
+
|
| 4 |
+
suite = json.load(open('test_suite.json'))['tests']
|
| 5 |
+
models = ['SmolLM2-135M-Instruct-mobile', 'Qwen2.5-0.5B-Instruct-mobile-int4']
|
| 6 |
+
|
| 7 |
+
for model_name in models:
|
| 8 |
+
model = load_model(model_name, backend='gguf')
|
| 9 |
+
for test in suite:
|
| 10 |
+
resp = model.chat(test['prompt'], max_tokens=50)
|
| 11 |
+
correct = test.get('expected_contains', '').lower() in resp.lower()
|
| 12 |
+
print(f'{"✅" if correct else "❌"} {model_name}: {test["id"]} = "{resp[:60]}"')
|