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

[Accelerator] We should not call to on modules that wraps accelerate loaded models #1172

Merged
merged 2 commits into from Mar 15, 2023

Conversation

younesbelkada
Copy link
Contributor

@younesbelkada younesbelkada commented Mar 10, 2023

What does this PR do?

In some training setups such as in trl: https://github.com/lvwerra/trl sometimes users create a new module that wraps modules that are loaded with accelerate. Check for example this class
I propose a simple fix in the accelerator to check if there is any immediate child module that has the hf_device_map attribute

cc @sgugger

I can confirm all slow tests pass except the similar ones as in #1155 - which I believe are related to the way I am creating my env

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Mar 10, 2023

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

@younesbelkada younesbelkada changed the title [Accelerator] We should to call to on modules that wrap accelerate loaded models [Accelerator] We should not to call to on modules that wrap accelerate loaded models Mar 10, 2023
@younesbelkada younesbelkada changed the title [Accelerator] We should not to call to on modules that wrap accelerate loaded models [Accelerator] We should not to call to on modules that wraps accelerate loaded models Mar 10, 2023
@younesbelkada younesbelkada changed the title [Accelerator] We should not to call to on modules that wraps accelerate loaded models [Accelerator] We should not call to on modules that wraps accelerate loaded models Mar 10, 2023
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.

Works for me, thanks!

@younesbelkada younesbelkada marked this pull request as ready for review March 10, 2023 12:43
@younesbelkada younesbelkada merged commit d1aa558 into main Mar 15, 2023
@younesbelkada younesbelkada deleted the fix-accelerator-issue branch March 15, 2023 07:28
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