Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 96bb4f4

Browse files
committedMar 18, 2025·
Move mode.train() to the training loop
1 parent 7c39a57 commit 96bb4f4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎recipes/full_finetune_distributed.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,6 @@ def validate(self) -> float:
811811
else float("inf")
812812
)
813813

814-
self._model.train()
815814
return avg_val_loss
816815

817816
def train(self) -> None:
@@ -848,6 +847,7 @@ def train(self) -> None:
848847
and self._device.type == "cuda"
849848
):
850849
torch.cuda.memory._record_memory_history()
850+
self._model.train()
851851
utils.batch_to_device(batch, self._device)
852852

853853
# Calculate the number of unmasked tokens in the current batch

0 commit comments

Comments
 (0)
Please sign in to comment.