Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -155,9 +155,9 @@ def cleanup_memory():
|
|
155 |
"""Centralized memory cleanup function"""
|
156 |
if torch.cuda.is_available():
|
157 |
torch.cuda.synchronize()
|
158 |
-
torch.cuda.empty_cache()
|
159 |
import time
|
160 |
time.sleep(0.1)
|
|
|
161 |
gc.collect()
|
162 |
|
163 |
|
@@ -225,10 +225,11 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
225 |
submitted_answer = agent(question_text)
|
226 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
227 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
228 |
-
cleanup_memory()
|
229 |
except Exception as e:
|
230 |
-
|
231 |
-
|
|
|
|
|
232 |
|
233 |
if not answers_payload:
|
234 |
print("Agent did not produce any answers to submit.")
|
|
|
155 |
"""Centralized memory cleanup function"""
|
156 |
if torch.cuda.is_available():
|
157 |
torch.cuda.synchronize()
|
|
|
158 |
import time
|
159 |
time.sleep(0.1)
|
160 |
+
torch.cuda.empty_cache()
|
161 |
gc.collect()
|
162 |
|
163 |
|
|
|
225 |
submitted_answer = agent(question_text)
|
226 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
227 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
|
|
228 |
except Exception as e:
|
229 |
+
print(f"Error running agent on task {task_id}: {e}")
|
230 |
+
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
|
231 |
+
finally:
|
232 |
+
cleanup_memory()
|
233 |
|
234 |
if not answers_payload:
|
235 |
print("Agent did not produce any answers to submit.")
|