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

Small fixes for balanced device maps #583

Merged
merged 1 commit into from
Jul 28, 2022
Merged

Small fixes for balanced device maps #583

merged 1 commit into from
Jul 28, 2022

Conversation

sgugger
Copy link
Collaborator

@sgugger sgugger commented Jul 28, 2022

This PR adds a couple of fixes to the balanced device map API, as using it on small models has given me a couple of errors.

  • First the GPU 0 should also have the buffer (contrarily to the initial implementation) because it always saves memory for the largest layer inside infer_auto_device_map (so if we don't give it the buffer, we end up with way less on the GPU 0).
  • Then we need to give extra room on the last GPU to avoid accidental CPU offload if one or two parameters end up without device at the end. The easiest way is just to leave it with the max memory.

@sgugger sgugger requested a review from muellerzr July 28, 2022 19:10
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jul 28, 2022

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

Copy link
Collaborator

@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.

LG2M, running CUDA tests first so lets make sure those pass

@sgugger sgugger merged commit d5a0fc2 into main Jul 28, 2022
@sgugger sgugger deleted the fix_balanced branch July 28, 2022 19:27
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

3 participants