Skip to content

Commit f0850a3

Browse files
committed
Merge remote-tracking branch 'origin' into 3p-integrations-crusoe
2 parents 1885095 + d6ae203 commit f0850a3

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

recipes/quickstart/finetuning/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This folder contains instructions to fine-tune Meta Llama 3 on a
88

99
using the canonical [finetuning script](../../../src/llama_recipes/finetuning.py) in the llama-recipes package.
1010

11-
If you are new to fine-tuning techniques, check out an overview: [](./LLM_finetuning_overview.md)
11+
If you are new to fine-tuning techniques, check out [an overview](./LLM_finetuning_overview.md).
1212

1313
> [!TIP]
1414
> If you want to try finetuning Meta Llama 3 in a Jupyter notebook you can find a quickstart notebook [here](./quickstart_peft_finetuning.ipynb)

recipes/quickstart/finetuning/quickstart_peft_finetuning.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"Copyright (c) Meta Platforms, Inc. and affiliates.\n",
99
"This software may be used and distributed according to the terms of the Llama 2 Community License Agreement.\n",
1010
"\n",
11-
"<a href=\"https://colab.research.google.com/github/meta-llama/llama-recipes/blob/main/recipes/finetuning/quickstart_peft_finetuning.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
11+
"<a href=\"https://colab.research.google.com/github/meta-llama/llama-recipes/blob/main/recipes/quickstart/finetuning/quickstart_peft_finetuning.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
1212
]
1313
},
1414
{

src/llama_recipes/finetuning.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def main(**kwargs):
167167
# Load the pre-trained peft model checkpoint and setup its configuration
168168
if train_config.from_peft_checkpoint:
169169
model = PeftModel.from_pretrained(model, train_config.from_peft_checkpoint, is_trainable=True)
170-
peft_config = model.peft_config()
170+
peft_config = model.peft_config
171171
# Generate the peft config and start fine-tuning from original model
172172
else:
173173
peft_config = generate_peft_config(train_config, kwargs)

src/llama_recipes/utils/train_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,11 @@ def train(model, train_dataloader,eval_dataloader, tokenizer, optimizer, lr_sche
151151
batch[key] = batch[key].to('cuda:0')
152152
with autocast():
153153
loss = model(**batch).loss
154+
total_loss += loss.detach().float()
154155
loss = loss / gradient_accumulation_steps
155156
if train_config.save_metrics:
156157
train_step_loss.append(loss.detach().float().item())
157158
train_step_perplexity.append(float(torch.exp(loss.detach().float())))
158-
total_loss += loss.detach().float()
159159
if train_config.use_fp16:
160160
# if fp16 is enabled, use gradient scaler to handle gradient update
161161
scaler.scale(loss).backward()

0 commit comments

Comments
 (0)