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

reset accelerate env variables after each test #24107

Merged
merged 1 commit into from Jun 8, 2023

Conversation

pacman100
Copy link
Contributor

What does this PR do?

Context:

For the failing tests in test_trainer_ext, the reason is given below:

  1. These tests are run via following command:
python -m pytest -v --make-reports=multi-gpu_tests_torch_cuda_extensions_gpu tests/deepspeed tests/extended
  1. Now, as DeepSpeed tests are run first, even though the AcceleratorState is reset during teardown, the env variable set by Accelerate ACCELERATE_USE_DEEPSPEED isn't deleted (if the test isn't a script run as a subprocess) and as such Accelerator object initialization in extended tests create DeepSpeedPlugin leading to them failing with - HFDeepSpeedPlugin raises config mismatch error

  2. Simple reproducer:

cd transformers
export CUDA_VISIBLE_DEVICES="0,1"
export RUN_SLOW="yes"
pytest -sv tests/deepspeed/test_deepspeed.py::TrainerIntegrationDeepSpeed::test_hf_ds_config_mismatch tests/extended/test_trainer_ext.py::TestTrainerExt::test_run_seq2seq

This PR fixes it by deleting all the env variables having ACCELERATE in them during test tearDown.

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!

Copy link
Contributor

@muellerzr muellerzr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jun 8, 2023

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

@sgugger sgugger merged commit 0f23605 into main Jun 8, 2023
21 checks passed
@sgugger sgugger deleted the smangrul/reset-accelerate-env-variables-in-teardown branch June 8, 2023 13:19
novice03 pushed a commit to novice03/transformers that referenced this pull request Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants