Skip to content

Commit

Permalink
Fix check for backword_pos (huggingface#23075)
Browse files Browse the repository at this point in the history
  • Loading branch information
winglian authored May 2, 2023
1 parent f31a510 commit c6c6658
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/transformers/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,9 @@ def __init__(
self.fsdp = ShardingStrategy.NO_SHARD

self.backward_prefetch = BackwardPrefetch.BACKWARD_PRE
if "backward_prefetch" in self.args.fsdp_config and "backward_pos" not in self.backward_prefetch:
if "backward_prefetch" in self.args.fsdp_config and "backward_pos" in self.args.fsdp_config.get(
"backward_prefetch", []
):
self.backward_prefetch = BackwardPrefetch.BACKWARD_POST

self.forward_prefetch = False
Expand Down

0 comments on commit c6c6658

Please sign in to comment.