-
Notifications
You must be signed in to change notification settings - Fork 27.1k
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
Bye bye env vars, keep everything as configs #34886
base: main
Are you sure you want to change the base?
Bye bye env vars, keep everything as configs #34886
Conversation
"accelerate", | ||
"launch", | ||
"--use_fsdp", | ||
"--main_process_port", | ||
f"{get_torch_dist_unique_port()}", | ||
"--num_processes", | ||
f"{torch.cuda.device_count()}", | ||
f"{self.test_file_dir}/test_trainer_fsdp.py", | ||
"--fsdp", | ||
"full_shard", | ||
"--fsdp_transformer_layer_cls_to_wrap", | ||
"GPT2Block", | ||
f"{self.test_file_dir}/test_trainer_fsdp.py", | ||
"--output_dir", | ||
f"{output_dir}", |
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.
Refactoring the test this way forces us to use the transformers parser rather than accelerate's CLI env var setting
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. |
Thanks for cleaning up the use of env vars. I only did a quick check, are there deprecation warnings added for fp16, bf16, etc.? It should be clearly communicated when these arguments will be removed, as a lot of code would be affected. |
Not yet but it will be, meant to open this as a draft just to make sure we're all okay w/ the core parts |
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.
Thanks for cleaning this up ! Left a few comments as reminder since this is still a draft
self.fp16 = mixed_precision_dtype == "fp16" | ||
self.bf16 = mixed_precision_dtype == "bf16" |
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.
It would be nice that we don't have to define them as I think the goal is to deprecate them ? Are we using them somewhere else ?
if self.mixed_precision_config is None: | ||
self.mixed_precision_config = {} |
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.
Make sure to replace the existing logic (e.g bf16_full_eval) with mixed_precision_config
What does this PR do?
As @BenjaminBossan found, (huggingface/accelerate#3252), the
TrainingArguments
will set environmental variables automatically when using Accelerate because before it wouldn't work otherwise. Nowadays the only env variable required for things to run smoothly is the ones for model init (fsdp cpu eff ram).This PR does a few things:
mixed_precision
gets set, to simplify the training arguments and combine 7 args into 2.Fixes # (issue)
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.
@SunMarc @Rocketknight1