Spaces:
Sleeping
Sleeping
updated tools
Browse files- local_submit.py +33 -0
local_submit.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
from smolagents import CodeAgent, HfApiModel
|
| 3 |
+
from tools.final_answer import FinalAnswerTool
|
| 4 |
+
import yaml
|
| 5 |
+
from dotenv import load_dotenv
|
| 6 |
+
import os
|
| 7 |
+
from models.openai_model import OpenAIModel
|
| 8 |
+
|
| 9 |
+
load_dotenv()
|
| 10 |
+
|
| 11 |
+
with open("metadata.jsonl", "r") as f:
|
| 12 |
+
questions = [json.loads(line) for line in f]
|
| 13 |
+
|
| 14 |
+
model = OpenAIModel()
|
| 15 |
+
|
| 16 |
+
results = []
|
| 17 |
+
for q in questions[:20]:
|
| 18 |
+
print(f"\nTask ID: {q['task_id']}")
|
| 19 |
+
print(f"Question: {q['Question']}")
|
| 20 |
+
try:
|
| 21 |
+
answer = model.run(q["Question"])
|
| 22 |
+
except Exception as e:
|
| 23 |
+
print("Error:", e)
|
| 24 |
+
answer = "error"
|
| 25 |
+
results.append({
|
| 26 |
+
"task_id": q["task_id"],
|
| 27 |
+
"model_answer": str(answer).strip(),
|
| 28 |
+
"reasoning_trace": None
|
| 29 |
+
})
|
| 30 |
+
|
| 31 |
+
with open("submission.jsonl", "w") as f:
|
| 32 |
+
for r in results:
|
| 33 |
+
f.write(json.dumps(r) + "\n")
|