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

Refactor tests to use accelerate launch #373

Merged
merged 36 commits into from
May 19, 2022
Merged

Refactor tests to use accelerate launch #373

merged 36 commits into from
May 19, 2022

Conversation

muellerzr
Copy link
Collaborator

Refactor tests to use accelerate launch

What does this add?

This PR refactors all the example tests to use accelerate launch to be ran, adjusting any testing logic that needs to be done to compensate for this. Mostly changing the accelerate.print mocks to use string matching instead based on stdout from subprocess.run

Why is it needed?

In order to have our tests be ran on more than one GPU, the tests needed to be refactored to allow for the accelerate launch command to be used via subprocess rather than calling it in python directly.

What parts of the API does this impact?

User-facing:

All of the example scripts now contain a small snippet denoting that a particular import is only used for testing, and should be ignored

Internal structure:

mocked_dataloaders was migrated to the test utils.

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

HuggingFaceDocBuilderDev commented May 18, 2022

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

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 working on this! Good for me with some renames.

examples/by_feature/checkpointing.py Outdated Show resolved Hide resolved
examples/by_feature/fsdp_with_peak_mem_tracking.py Outdated Show resolved Hide resolved
tests/test_examples.py Outdated Show resolved Hide resolved
tests/test_examples.py Outdated Show resolved Hide resolved
muellerzr and others added 2 commits May 19, 2022 11:24
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
@muellerzr muellerzr merged commit 23c0341 into main May 19, 2022
@muellerzr muellerzr deleted the test-multi-gpu branch May 19, 2022 15:48
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