Skip to content

Commit

Permalink
Check for optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
muellerzr committed Apr 24, 2024
1 parent bd9673a commit 7c3704d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/transformers/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4368,6 +4368,10 @@ def create_accelerator_and_postprocess(self):
"`non_blocking` is only supported in accelerate v0.30.0 and above. Please upgrade accelerate to use this feature."
)
else:
if non_blocking and not self.args.dataloader_pin_memory:
logger.warning(
"`non_blocking` is enabled but `dataloader_pin_memory` is not. For the best performance, it's recommended to enable both."
)
dataloader_config.non_blocking = non_blocking
# this would have been updated above, no need for it anymore
accelerator_config.pop("gradient_accumulation_kwargs")
Expand Down

0 comments on commit 7c3704d

Please sign in to comment.