-
Notifications
You must be signed in to change notification settings - Fork 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
Add a utility for writing a barebones config file #371
Conversation
The documentation is not available anymore as the PR was closed or merged. |
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 adding this!
src/accelerate/utils/other.py
Outdated
@@ -122,11 +122,9 @@ def write_basic_config(mixed_precision="no", save_location: str = default_json_c | |||
Args: | |||
mixed_precision (`str`, *optional*, defaults to "no"): | |||
Mixed Precision to use. Should be one of "no", "fp16", or "bf16" | |||
save_location (`str`, *optional*): | |||
save_location (`str`, *optional*, defaults to "~/.cache/huggingface/accelerate/default_config.yaml"): |
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.
This won't be the default location for everyone, so I'd just say defaults to the default config path and expand a bit in the docstring that it's inside the default cache of hugging face, and may add which env variable control it.
Introduce barebones config file generator
What does this add?
This PR adds a
write_basic_config
file that will write a barebones config file automatically setting the GPU's to be the maximum GPUs available (or CPU), and takes in one param for mixed precisionWho is it for?
Folks who want to avoid running
accelerate config
and for tests that need to be ran withaccelerate launch
.Why is it needed?
Along with a request in the fastai integration fastai/fastai#3646, I was working on fixing up the tests we currently run and was noticing some frustration when trying to setup and configure them to be launched on multi gpu.
What parts of the API does this impact?
User-facing:
Adds a
write_basic_config
config totest_utils/testing.py
, that should be used in tests but users can optionally use it to setup a basic configuration if wanted. It will not override an already setup configuration.Basic Usage Example(s):
When would I use it, and when wouldn't I?
You'd use it when you don't want to run
accelerate config
and don't care about TPU setup or a fine-grained configuration setup for multi-gpu