Skip to content

[Accelerate] allow get_execution_device to be used when initializing a model #303

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

Merged
merged 2 commits into from
Apr 23, 2025

Conversation

kylesayrs
Copy link
Contributor

@kylesayrs kylesayrs commented Apr 22, 2025

Purpose

Changes

  • Remove meta device check, which fails if in the init_empty_weights context
  • Make execution device logic more explicit, implement fallback for modules which do not have parameters

Testing

  • Added tests to check behavior under the init_empty_weights context

Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
@kylesayrs kylesayrs merged commit 8aa8b82 into main Apr 23, 2025
1 check passed
@kylesayrs kylesayrs deleted the kylesayrs/get_execution_device-meta branch April 23, 2025 18:00
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.

3 participants