accelerate
29be4788 - [WIP] FEAT Decorator to purge accelerate env vars (#3252)

Commit
1 year ago
[WIP] FEAT Decorator to purge accelerate env vars (#3252) * [WIP] FEAT Decorator to purge accelerate env vars In some circumstances, calling certain classes or functions can result in accelerate env vars being set and not being cleaned up afterwards. As an example, when calling: TrainingArguments(fp16=True, ...) The following env var will be set: ACCELERATE_MIXED_PRECISION=fp16 This can affect subsequent code, since the env var takes precedence over TrainingArguments(fp16=False). This is especially relevant for unit testing, where we want to avoid the individual tests to have side effects on one another. Decorate the unit test function or whole class with this decorator to ensure that after each test, the env vars are cleaned up. This works for both unittest.TestCase and normal classes (pytest); it also works when decorating the parent class. In its current state, this PR adds the new decorator and tests it, but the decorator is not yet applied to potentially problematic functions or classes. * Linter * Refactor code to be more readable --------- Co-authored-by: [[ -z $EMAIL ]] && read -e -p "Enter your email (for git configuration): " EMAIL <muellerzr@gmail.com>
Parents
Loading