Spaces:
Running
Running
Commit ·
9bb611a
1
Parent(s): 46acf43
Fix benchmark output saving: add results dir and print errors
Browse files- Dockerfile +3 -0
- inference.py +2 -2
- server/app.py +2 -2
Dockerfile
CHANGED
|
@@ -12,6 +12,9 @@ COPY pyproject.toml .
|
|
| 12 |
RUN pip install --no-cache-dir . 2>/dev/null || pip install --no-cache-dir \
|
| 13 |
fastapi uvicorn pydantic openai requests packaging gradio python-dotenv
|
| 14 |
|
|
|
|
|
|
|
|
|
|
| 15 |
# Copy project files
|
| 16 |
COPY . .
|
| 17 |
|
|
|
|
| 12 |
RUN pip install --no-cache-dir . 2>/dev/null || pip install --no-cache-dir \
|
| 13 |
fastapi uvicorn pydantic openai requests packaging gradio python-dotenv
|
| 14 |
|
| 15 |
+
# Make sure results directory exists and is writable by any user
|
| 16 |
+
RUN mkdir -p results && chmod 777 results
|
| 17 |
+
|
| 18 |
# Copy project files
|
| 19 |
COPY . .
|
| 20 |
|
inference.py
CHANGED
|
@@ -333,8 +333,8 @@ def main() -> None:
|
|
| 333 |
from server.benchmark_store import append_result
|
| 334 |
append_result(MODEL_NAME, MODEL_NAME, scores)
|
| 335 |
print(f"💾 Results saved (avg: {avg:.4f})", flush=True)
|
| 336 |
-
except Exception:
|
| 337 |
-
|
| 338 |
|
| 339 |
|
| 340 |
if __name__ == "__main__":
|
|
|
|
| 333 |
from server.benchmark_store import append_result
|
| 334 |
append_result(MODEL_NAME, MODEL_NAME, scores)
|
| 335 |
print(f"💾 Results saved (avg: {avg:.4f})", flush=True)
|
| 336 |
+
except Exception as e:
|
| 337 |
+
print(f"⚠️ Failed to save results to disk: {e}", flush=True)
|
| 338 |
|
| 339 |
|
| 340 |
if __name__ == "__main__":
|
server/app.py
CHANGED
|
@@ -573,8 +573,8 @@ def run_benchmark(body: dict):
|
|
| 573 |
# Persist to disk via benchmark_store
|
| 574 |
try:
|
| 575 |
append_result(model_name, model_id, scores)
|
| 576 |
-
except Exception:
|
| 577 |
-
|
| 578 |
yield f"data: {json.dumps({'type': 'done', 'result': result})}\n\n"
|
| 579 |
|
| 580 |
return StreamingResponse(event_stream(), media_type="text/event-stream")
|
|
|
|
| 573 |
# Persist to disk via benchmark_store
|
| 574 |
try:
|
| 575 |
append_result(model_name, model_id, scores)
|
| 576 |
+
except Exception as e:
|
| 577 |
+
print(f"Failed to append result: {e}", flush=True)
|
| 578 |
yield f"data: {json.dumps({'type': 'done', 'result': result})}\n\n"
|
| 579 |
|
| 580 |
return StreamingResponse(event_stream(), media_type="text/event-stream")
|