Repository navigation
Conversation
Collaborator
|
Looks great @emerardd, merging as is! |
jlarson4
added a commit
that referenced
this pull request
Nov 16, 2026
Brings in #2019 (explicit dtype on the from-module path), #2020 (dtype, device and eval() on the no-weights path), #2021 and #2023. Conflicts resolved in _bridge_builder.py (one multi_gpu import; the docstring covers both the dtype cast and the device move), source.py (dev's load_weights docstring) and interchange.py (dev's random_init_bridge, since boot now applies dtype and device itself). Follow-ons forced by #2020: boot's no-weights device read-back and its test are dropped, because that path now moves the model and cfg.device follows the move; the random-init interchange test returns to dev's version. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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
Preserve mask-derived position coordinates when resuming a forward with
start_at_layer.Residual re-entry travels through
inputs_embeds, but the mask-position derivation excluded every embeddings input. A cached Llama residual resumed with the original attention mask could therefore use physical column positions instead of the compressed positions used in the token forward. An interior mask gap changes the relative RoPE coordinates: an unmodified residual no longer reproduces the original logits.With a random tiny Llama (3 layers, width 32, 4 query/2 KV heads), prompt
[1, 2, 0, 3, 4]and mask[1, 1, 0, 1, 1], attended-token logit errors at resumed layers 0/1/2 were5.54e-4,2.29e-4and1.60e-4. Supplying only the original derived positions reduced all three errors to zero.Allow the existing 2-D-mask position policy to handle residual inputs when
start_at_layeris set. Explicitposition_idsand the target-model compatibility gate still take precedence; ordinary externalinputs_embedsbehavior is unchanged. Thestart_at_layerdocstring now describes replaying the original mask and any explicit positions.Type of change
Validation
mypy .: 391 source files passed.git diff --checkpassed.The complete suite and GPU/MPS checks were not run. Existing SWIG deprecation warnings remain.
Checklist
Only the affected unit-test surface was run locally; the full-unit-suite checkbox is intentionally unchecked. Documentation changes are in the API docstring.