Download finalize_report.py from ACCC1380/realstyle: direct link, hf CLI and curl.
- Browser
- Download file 1.07 kB
-
https://huggingface.co/ACCC1380/realstyle/resolve/main/finalize_report.py
- Command line
-
hf download hf://ACCC1380/realstyle/finalize_report.py
-
curl -L -o finalize_report.py https://huggingface.co/ACCC1380/realstyle/resolve/main/finalize_report.py
1.07 kB
| import json,time,tomllib,hashlib,os | |
| from pathlib import Path | |
| root=Path('/data/realstyle') | |
| while True: | |
| try:r=json.loads((root/'run-result.json').read_text()) | |
| except (OSError,ValueError):time.sleep(5);continue | |
| if r['status']=='failed':break | |
| if r['status']=='complete': | |
| time.sleep(5) | |
| r=json.loads((root/'run-result.json').read_text()) | |
| r['batch_size']=tomllib.loads((root/'dataset.toml').read_text())['datasets'][0]['batch_size'] | |
| r['gradient_checkpointing']=False | |
| r['final_model_sha256']=hashlib.sha256(Path(r['final_model']).read_bytes()).hexdigest() | |
| (root/'run-result.json').write_text(json.dumps(r,indent=2)) | |
| p=root/'README.txt';s=p.read_text();s=s.replace('"batch_size": 1','"batch_size": '+str(r['batch_size']));p.write_text(s) | |
| p=root/'status.json';s=json.loads(p.read_text());s.update(phase='complete',step=r['steps'],epoch=r['epochs'],remaining_seconds_estimate=0);p.write_text(json.dumps(s,indent=2)) | |
| (root/'report-finalized').write_text('Batch size verified from dataset configuration; final checksum recorded.\n');os.sync();break | |
| time.sleep(5) | |