What Happened?
In acc.py evaluation metric file, output metrics are manually written to hardcoded JSON filenames:
# ❌ HARDCODED - Ignores workspace structure
with open("accuracy_results_model.json", "w", encoding="utf-8") as f:
json.dump(results, f, ensure_ascii=False, indent=4)
Impact:
- ✅ Ignores Ianvs
benchmarkingjob.yaml workspace
- ✅ Pollutes root directory with
accuracy_results_*.json
- ✅ Overwrites metrics from different benchmarking jobs
- ✅ Bypasses experimental versioning
What Should Happen? ✅
Metrics should save to designated workspace directory to:
- Keep root directory clean
- Enable versioning across benchmarking iterations
- Respect Ianvs/Sedna workspace context
🔍 Reproduction Steps
- Run benchmarking job triggering
acc.py metrics
- Check current directory →
accuracy_results_model.json appears
- ❌ No workspace structure respected
💡 Proposed Fix
Pass workspace path via environment variable and construct paths dynamically:
# ✅ FIXED - Respects Ianvs workspace context
import os
import json
# Resolve workspace from environment (fallback to current dir)
output_dir = os.environ.get("IANVS_EVAL_WORKSPACE", ".")
output_path = os.path.join(output_dir, "accuracy_results_model.json")
# Safe directory creation
os.makedirs(output_dir, exist_ok=True)
with open(output_path, "w", encoding="utf-8") as f:
json.dump(results, f, ensure_ascii=False, indent=4)
📁 Before vs After
| Aspect |
Before (Bug) |
After (Fixed) |
| File Path |
./accuracy_results_model.json |
./workspace/accuracy_results_model.json |
| Workspace Respect |
❌ Ignored |
✅ Uses IANVS_EVAL_WORKSPACE |
| Root Pollution |
✅ Yes |
❌ No |
| Versioning |
❌ Overwrites |
✅ Isolated |
🎯 Complete Fixed acc.py Function
def save_metrics(results, filename="accuracy_results_model.json"):
"""Save metrics to Ianvs workspace directory."""
import os
import json
# Get workspace from environment or fallback
output_dir = os.environ.get("IANVS_EVAL_WORKSPACE", ".")
output_path = os.path.join(output_dir, filename)
# Ensure directory exists
os.makedirs(output_dir, exist_ok=True)
with open(output_path, "w", encoding="utf-8") as f:
json.dump(results, f, ensure_ascii=False, indent=4)
print(f"✅ Metrics saved: {output_path}")
✅ Verification
# Set workspace env and test
export IANVS_EVAL_WORKSPACE="./experiment_1/output"
python acc.py
# ✅ File appears in: ./experiment_1/output/accuracy_results_model.json
Priority: High - Clean workspace integration essential for production benchmarking! 🚀
What Happened?
In
acc.pyevaluation metric file, output metrics are manually written to hardcoded JSON filenames:Impact:
benchmarkingjob.yamlworkspaceaccuracy_results_*.jsonWhat Should Happen? ✅
Metrics should save to designated workspace directory to:
🔍 Reproduction Steps
acc.pymetricsaccuracy_results_model.jsonappears💡 Proposed Fix
Pass workspace path via environment variable and construct paths dynamically:
📁 Before vs After
./accuracy_results_model.json./workspace/accuracy_results_model.jsonIANVS_EVAL_WORKSPACE🎯 Complete Fixed
acc.pyFunction✅ Verification
Priority: High - Clean workspace integration essential for production benchmarking! 🚀