Fix issue #39191 respect accelerate config to disable torch.dynamo compilation#39683
Fix issue #39191 respect accelerate config to disable torch.dynamo compilation#39683bonpiedlaroute wants to merge 5 commits intohuggingface:mainfrom
Conversation
gante
left a comment
There was a problem hiding this comment.
Thank you for opening the PR!
LGTM, added a question/small request to clear out before merging :)
| disable_env_vars = [ | ||
| "ACCELERATE_DISABLE_TORCH_DYNAMO", # Accelerate-specific | ||
| "TORCH_DYNAMO_DISABLE", # Pytorch standard | ||
| "DISABLE_TORCH_DYNAMO", # Common alternative |
There was a problem hiding this comment.
This is not a standard env var, correct? If not, then let's remove it 🤗 (let's stick to the known flags and avoid adding more noise, which may have unintended consequences)
There was a problem hiding this comment.
You're absolutely right! After double checking pytorch source code, the official flag is: TORCHDYNAMO_DISABLE
PR updated.
Thanks,
Noël
…h.dynamo compilation
a6943a8 to
4872958
Compare
|
Please note that the failing test |
Yeah don't worry ! I'll rerun the CI to merge this |
|
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. |
Head branch was pushed to by a user without write access
|
@bot /style |
|
Style fix is beginning .... View the workflow run here. |
|
View the CircleCI Test Summary for this PR: https://huggingface.co/spaces/transformers-community/circle-ci-viz?pr=39683&sha=824bdc |
Description
Fixes #39191 where transformers ignored accelerate configuration to disable torch.dynamo, leading to unexpected compilation and
FailOnRecompileLimitHiterrors.Problem
When users configure accelerate to disable torch.dynamo, transformers' automatic compilation in
_valid_auto_compile_criteria()was not respecting this setting, causing:FailOnRecompileLimitHitcrashes in distributed training scenariosSolution
_is_dynamo_compilation_disabled()method that checks standard environment variables_valid_auto_compile_criteria()to respect these environment variables before enabling compilationEnvironment Variables Supported
TORCHDYNAMO_DISABLE=1Tests done
Usage
Users experiencing the issue can now use:
export TORCHDYNAMO_DISABLE=1 python training_script.pyWho can review?
@SunMarc @gante @zach-huggingface and @qgallouedec