Skip to content
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

Merged
merged 10 commits into from
May 18, 2022
Merged

Conversation

muellerzr
Copy link
Collaborator

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 precision

Who is it for?

Folks who want to avoid running accelerate config and for tests that need to be ran with accelerate 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 to test_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):

from accelerate.test_utils import write_basic_config
write_basic_config("fp16")

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

@muellerzr muellerzr added the enhancement New feature or request label May 18, 2022
@muellerzr muellerzr requested a review from sgugger May 18, 2022 15:25
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented May 18, 2022

The documentation is not available anymore as the PR was closed or merged.

@muellerzr muellerzr requested a review from sgugger May 18, 2022 15:51
Copy link
Collaborator

@sgugger sgugger left a 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 Show resolved Hide resolved
src/accelerate/utils/other.py Outdated Show resolved Hide resolved
@@ -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"):
Copy link
Collaborator

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.

@muellerzr muellerzr requested a review from sgugger May 18, 2022 17:11
@muellerzr muellerzr merged commit 043d2ec into main May 18, 2022
@muellerzr muellerzr deleted the write_config branch May 18, 2022 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants