realstyle / finalize_report.py
ACCC1380's picture
Upload Anima Base realstyle LoRA: 30 epochs and training artifacts
acfbd40 verified
Raw History Blame Contribute Delete
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)