File size: 741 Bytes
2613ced | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | import json
from pathlib import Path
base_dir = Path(
"/work/jf381/output/fst_353M_bert_update_2_6b_test/checkpoints/mrpc/lr_2e-05"
)
best = {
"score": float("-inf"),
"restart": None,
"path": None,
}
for meta_path in base_dir.glob("restart_*/run_meta.json"):
with open(meta_path) as f:
meta = json.load(f)
score = meta.get("best_score")
restart = meta.get("restart")
if score is not None and score > best["score"]:
best.update({
"score": score,
"restart": restart,
"path": str(meta_path.parent),
})
print("Highest best_score:")
print(f" score : {best['score']}")
print(f" restart : {best['restart']}")
print(f" path : {best['path']}")
|