Skip to content

Commit 66e1867

Browse files
authored
Fix save metric FileNotFoundError when finetuning
1 parent b2eec4f commit 66e1867

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/llama_recipes/utils/train_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ def train(model, train_dataloader,eval_dataloader, tokenizer, optimizer, lr_sche
103103
val_loss =[]
104104

105105
if train_config.save_metrics:
106+
if not os.path.exists(train_config.output_dir):
107+
os.makedirs(train_config.output_dir, exist_ok=True)
106108
metrics_filename = f"{train_config.output_dir}/metrics_data_{local_rank}-{datetime.now().strftime('%Y-%m-%d_%H-%M-%S')}.json"
107109
train_step_perplexity = []
108110
train_step_loss = []

0 commit comments

Comments
 (0)