File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 11import json
22import math
3+ from datetime import datetime
34
45from art .utils .deploy_model import (
56 LoRADeploymentJob ,
@@ -241,7 +242,7 @@ async def _delete_checkpoints(
241242 )
242243 steps_to_keep .append (best_step )
243244 except FileNotFoundError :
244- pass
245+ print ( f'" { output_dir } /history.jsonl" not found' )
245246 except pl .exceptions .ColumnNotFoundError :
246247 print (f'No "{ benchmark } " metric found in history' )
247248 delete_checkpoints (output_dir , steps_to_keep )
@@ -445,6 +446,17 @@ def _log_metrics(
445446 metrics = {f"{ split } /{ metric } " : value for metric , value in metrics .items ()}
446447 step = step if step is not None else self .__get_step (model )
447448
449+ with open (f"{ get_model_dir (model = model , art_path = self ._path )} /history.jsonl" , "a" ) as f :
450+ f .write (
451+ json .dumps (
452+ {
453+ k : v for k , v in metrics .items () if v == v
454+ } # Filter out NaN values
455+ | {"step" : step , "recorded_at" : datetime .now ().isoformat ()}
456+ )
457+ + "\n "
458+ )
459+
448460 # If we have a W&B run, log the data there
449461 if run := self ._get_wandb_run (model ):
450462 # Mark the step metric itself as hidden so W&B doesn't create an automatic chart for it
You can’t perform that action at this time.
0 commit comments