huggingface / accelerate

🚀 A simple way to launch, train, and use PyTorch models on almost any device and distributed configuration, automatic mixed precision (including fp8), and easy-to-configure FSDP and DeepSpeed support
https://huggingface.co/docs/accelerate
Apache License 2.0
7.98k stars 974 forks source link

Add case-insensitive parsing of bool environment variables #3222

Open wizeng23 opened 3 weeks ago

wizeng23 commented 3 weeks ago

Some parts of the codebase use str_to_bool to do case-insensitive parsing of bool environment variables, while others use parse_flag_from_env. However, some are case-sensitive, such as for ACCELERATE_USE_FSDP. Given it's case-sensitive, this code is actually incorrect. Many other flags have case-insensitive parsing, so it would be convenient to have similar behavior across all bool flags.