remove redundant file linking for tie_word_embeddings#506
Merged
HenryNdubuaku merged 1 commit intomainfrom Mar 9, 2026
Merged
Conversation
Signed-off-by: jakmro <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes filesystem-level hardlink creation for output_weight.weights when tie_word_embeddings is enabled, relying on the runtime’s tie_word_embeddings behavior instead of duplicating/linking weight files during conversion.
Changes:
- Removed
os.link()-based linking fromtoken_embeddings.weightstooutput_weight.weightsundertie_word_embeddings. - Simplified the tied-embedding branch to only mark output projection tensors as “handled” in
saved_tensor_full_names.
Comments suppressed due to low confidence (2)
python/src/converter.py:222
- With the hardlinking removed,
tie_word_embeddings=True+embedding_found=Falsenow silently results in no output projection being written and no warning being emitted. Consider restoring an explicit warning/error in this branch when embeddings weren’t exported (since the runtime will not have an output weight to use).
if tie_word_embeddings:
if embedding_found:
for name in OUTPUT_NAMES:
if name in state_dict:
saved_tensor_full_names.add(name)
python/src/converter.py:223
- When
tie_word_embeddingsis enabled, the converter no longer overwrites/removes any pre-existingoutput_weight.weightsin the output directory. If a previous (partial) conversion left that file behind, it will remain and can make the output directory inconsistent. Consider deletingoutput_weight.weightswhentie_word_embeddingsis true (or ensuring the output dir is cleaned before conversion).
if tie_word_embeddings:
if embedding_found:
for name in OUTPUT_NAMES:
if name in state_dict:
saved_tensor_full_names.add(name)
else:
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
No description provided.