Repository navigation
fix: take cfg.device from a pre-loaded hf_model instead of get_device() - #1949
Merged
Merged
Conversation
jlarson4
approved these changes
Oct 26, 2026
jlarson4
left a comment
Collaborator
There was a problem hiding this comment.
Looks good! I'll merge once CI passes
Collaborator
|
Update: there is a bug with the Qwen3.5 testing model we use for CI that is preventing Full Code Coverage from passing, I will patch |
Closed
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #1945.
Without
device=,bootkeptcfg.deviceatget_device()for anhf_modelwith nohf_device_map, but it never moves that model. When the weights were on another device, calls that move their inputs tocfg.devicefailed, includingbridge("text"),run_with_hookson text andgenerate.get_device()is now called only whenbootloads the model itself. Withoutdevice=, anhf_modelwith nohf_device_mapgetscfg.devicefrom the existing fallback that reads its first parameter, as inbuild_bridge_from_module. An explicitdevice=and models with anhf_device_mapare unchanged.test_boot_device.pyboots a tinyfrom_configGPT-NeoX built on themetadevice throughhf_model=, withget_devicepatched to return"cuda", and checks thatcfg.deviceis"meta", which neitherget_device()nor a CPU default would give. It fails ondev(cfg.deviceis"cuda") and passes with the fix. On MPS, the issue's example and its CPU variant withTRANSFORMERLENS_ALLOW_MPS=1now run.Type of change
Checklist: