-
Notifications
You must be signed in to change notification settings - Fork 30.6k
Fix TrainingArguments.parallelism_config NameError with accelerate<1.10.1 #40818
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix TrainingArguments.parallelism_config NameError with accelerate<1.10.1 #40818
Conversation
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, waiting for @SunMarc for final review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, thanks for this fix ! cc @S1ro1 for visibility, this created some typing issue for ppl relying on older version of accelerate
Thanks for the fix, didn't know this would break type-checkers, my bad. |
…10.1 (huggingface#40818) Fix ParallelismConfig type for accelerate < 1.10.1 Co-authored-by: Marc Sun <57196510+SunMarc@users.noreply.github.com>
…10.1 (huggingface#40818) Fix ParallelismConfig type for accelerate < 1.10.1 Co-authored-by: Marc Sun <57196510+SunMarc@users.noreply.github.com>
…10.1 (huggingface#40818) Fix ParallelismConfig type for accelerate < 1.10.1 Co-authored-by: Marc Sun <57196510+SunMarc@users.noreply.github.com>
Fix
TrainingArguments.parallelism_config
NameError with accelerate<1.10.1:This PR fixes a runtime compatibility issue in TrainingArguments with accelerate<1.10.1.
Problem
With accelerate<1.10.1, the module
accelerate.parallelism_config
does not exist.TrainingArguments
currently annotates the field as:When
HfArgumentParser
callstyping.get_type_hints
on this dataclass, Python 3.12 attempts to resolve theForwardRef("ParallelismConfig")
and fails.See failing CI in downstream TRL: https://github.com/huggingface/trl/actions/runs/17635808933/job/50111711153
Minimal Reproducible Example
Solution
Optional[ParallelismConfig]
to avoid creating aForwardRef
This ensures
get_type_hints(TrainingArguments)
works across Python versions and with older accelerate installs.