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

Currently multi-gpu generate does not work with hf.generate for hf checkpoints. This PR fixes that. #1332

Merged

Conversation

ShashankMosaicML
Copy link
Contributor

@ShashankMosaicML ShashankMosaicML commented Jul 2, 2024

Multi gpu generation using hf.generate with device map = 'auto' does pipeline parallelism and moves different modules to different gpus. This results in input tensors to certain operations being on different gpus than other inputs to that operation, which results in an error. This PR moves the tensors to match the other tensors. This should not slow down training because during training all of these tensor movements should be no-ops.

@ShashankMosaicML ShashankMosaicML marked this pull request as ready for review July 2, 2024 20:20
@ShashankMosaicML ShashankMosaicML requested a review from a team as a code owner July 2, 2024 20:20
Copy link
Contributor

@snarayan21 snarayan21 left a comment

Choose a reason for hiding this comment

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

would like a bit of clarity, thanks for submitting

llmfoundry/models/layers/dmoe.py Show resolved Hide resolved
llmfoundry/models/layers/attention.py Show resolved Hide resolved
Copy link
Collaborator

@dakinggg dakinggg left a comment

Choose a reason for hiding this comment

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

approving to unblock

@ShashankMosaicML ShashankMosaicML merged commit 199c3b9 into mosaicml:main Jul 2, 2024
9 checks passed
@ShashankMosaicML ShashankMosaicML deleted the changes_for_hf_generate branch July 2, 2024 22:55
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.

4 participants