Repository navigation
test(interop): forward the round-trip fixture's inputs on the model device (#4908) - #4911
Merged
Merged
Conversation
…evice (#4908) #4871 stopped installing the per-module AlignDevicesHook for a single-device placement, so a direct forward no longer moves CPU inputs to the accelerator. The [gptq_triton] case of test_load_state_dict_round_trip_preserves_v1_model loaded on cuda and forwarded CPU input_ids, raising 'Expected all tensors to be on the same device ... index is on cpu'. Move the fixture's inputs to the model's device; the round-trip assertions are unchanged. Red on main d8758c4 (1 failed), green here (27 passed, 1 skipped).
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.
Fixes #4908.
Cause
#4871 deliberately stopped installing the per-module
AlignDevicesHookfor a single-device placement (the hooks pinned the model in a reference cycle), so a direct forward no longer moves CPU inputs to the accelerator.tests/test_checkpoint_interop_4053.py::_logitsalways built itsinput_idson the CPU, and the[gptq_triton]case loads oncuda:Fix
_logitsnow forwards its inputs on the model's own device (_model_devicehelper, CPU fallback). The round-trip assertions are unchanged;generate()on CPUinput_idsis unaffected because transformers moves its inputs.Evidence
origin/maind8758c481ba67030(#4871, first bad commit)6ec93e63(before #4871)ruff check tests: cleantests/load on the CPU.Residual risk
next(model.parameters()).device; a parameter-free model falls back to CPU, which is correct for every fixture in this file.