Skip to content

[device_map] fix device_map check behaviour. #9821

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

Closed
wants to merge 11 commits into from

Conversation

sayakpaul
Copy link
Member

What does this PR do?

Follow-up of #9449. It introduced a bug when doing:

key for key, component in self.components.items() if model_has_device_map(component)

For models that have sharded checkpoints (such as FluxTransformer2DModel), we will always set device_map:

device_map = {"": "cpu"}

So, this PR:

  1. When a device map only has CPU we need to account for it. We also add a test for it in this PR.
  2. Reuse model_has_device_map() functionality.

@sayakpaul sayakpaul requested a review from DN6 October 31, 2024 16:47
@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.

@sayakpaul
Copy link
Member Author

Unrelated test failures.

@sayakpaul
Copy link
Member Author

Closing in light of #9827.

@sayakpaul sayakpaul closed this Nov 1, 2024
@sayakpaul sayakpaul deleted the fix-device-map-check branch November 1, 2024 02:33
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.

2 participants