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

Fix: multigpu training #33271

Merged
merged 1 commit into from
Sep 4, 2024
Merged

Conversation

zucchini-nlp
Copy link
Member

What does this PR do?

Addresses issues in LLaVA-VL/LLaVA-NeXT#79 (comment) and huggingface/trl#1785 (comment).

I could trace the issue to the line where we move the model to args.device which apparently moved the model from multigpu to a single device. That caused device mismatch errors where the kwargs are moved to device from hf-device-map while the weights are all in args.device. I am not 100% sure this is the right fix, as I am not a Trainer master so pls let me know if there's a better way to check that

I guess @SunMarc for multigpu related issues

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Member

@SunMarc SunMarc 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 the fix @zucchini-nlp ! This is the right attribute to check !

@SunMarc SunMarc requested a review from amyeroberts September 3, 2024 12:10
Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

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

Ok, thanks both! LGTM

Copy link
Collaborator

@amyeroberts amyeroberts left a comment

Choose a reason for hiding this comment

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

LGTM - thanks for digging into this and fixing!

I wonder whether this means we might end up with different states in the trainer workflow for multigpu vs single gpu models i.e. we can't assume correctly whether we're on the device or not.

A more robust fix in the future would be to have _move_model_to_device to be compatible with the multigpu environment

@zucchini-nlp zucchini-nlp merged commit 35f72eb into huggingface:main Sep 4, 2024
21 checks passed
BernardZach pushed a commit to BernardZach/transformers that referenced this pull request Dec 5, 2024
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.

5 participants