Skip to content

Commit abff664

Browse files
committed
small nit fixes
ghstack-source-id: 37a3f34 Pull Request resolved: #1694
1 parent fcf3f7a commit abff664

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

torchtitan/train.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ def forward_backward_step(
451451
with self.maybe_enable_amp:
452452
pred = model_parts[0](inputs, eos_id=self.tokenizer.eos_id)
453453
loss = self.loss_fn(pred, labels)
454-
# need to free to before bwd to avoid peaking memory
454+
# need to free pred before bwd to avoid peaking memory
455455
del pred
456456
loss.backward()
457457

@@ -471,7 +471,7 @@ def train_step(
471471
accumulated_losses = []
472472
# If data runs out during gradient accumulation, that
473473
# entire step will not be executed.
474-
for microbatch in range(self.gradient_accumulation_steps):
474+
for _microbatch in range(self.gradient_accumulation_steps):
475475
input_dict, labels = next(data_iterator)
476476
loss = self.forward_backward_step(input_dict, labels)
477477
accumulated_losses.append(loss.detach())

0 commit comments

Comments
 (0)