File size: 581 Bytes
968e24d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""Monitor training progress"""
import json
from pathlib import Path
import time

log_file = Path("outputs/qa_model/trainer_state.json")

print("Monitoring training progress...\n")

while True:
    if log_file.exists():
        with open(log_file) as f:
            state = json.load(f)
        
        if 'log_history' in state:
            latest = state['log_history'][-1]
            print(f"Step {latest.get('step', 0):5d} | "
                  f"Loss: {latest.get('loss', 0):.4f} | "
                  f"Eval Loss: {latest.get('eval_loss', 'N/A')}")
    
    time.sleep(10)