Repository navigation
Conversation
With either knob False the module is None from construction and its state-dict keys never exist, so wrappers that embed tokens externally or consume hidden states directly no longer build modules they discard. tie_embeddings=True with either omitted raises ValueError, forward with tokens and no embedding points at modality.inputs_embeds, and a missing head returns hidden states. Defaults are unchanged. refs #263 Co-Authored-By: Timothy Ngotiaoco <timothy_ngotiaoco@harvard.edu>
generate() sampled hidden states as logits when the output head was omitted, and with the embedding omitted it failed only after switching to eval mode and allocating the KV caches. It now raises a ValueError for either omitted module before doing either. With the embedding omitted, tensor parallelism lost its Replicate input hook while SequenceParallel stayed on, so inputs_embeds would be labeled Shard(1). apply_tensor_parallel now raises a ValueError for a Transformer built without either module, before touching the mesh or the model. Pipeline stages, which hold only some modules, are accepted as before. refs #263 Co-Authored-By: Timothy Ngotiaoco <timothy_ngotiaoco@harvard.edu>
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
amazloumi
marked this pull request as draft
October 16, 2026 14:38
…dding-head-knobs # Conflicts: # CHANGELOG.md
This branch has not been deployed
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.
Summary
include_token_embeddingandinclude_output_head(defaultTrue) toTransformer. WhenFalsethe module is never built and its state-dict keys never exist, for wrappers that embed inputs externally or consume hidden states.tie_embeddings=Truewith either module omitted raises at construction.forwardwithtokensand no embedding raises before any compute and points atmodality.inputs_embeds. Without a head,forwardreturns hidden states.generate()andapply_tensor_parallelreject a model built with either module omitted, before any cache allocation or mesh access. Pipeline stage modules are unaffected.docs/architecture/model.md.Testing
uv run ruff checkanduv run ruff format --checkpass on the touched filesuv run pyright kempnerforge/passes (0 errors)uv run pytest tests/unit/: 2277 passed, 3 skippedforward,generate()and tensor parallelism; seeded mutations of each guard are caughtCloses #263