Skip to content

Tie-embed-conversion-fix#454

Merged
HenryNdubuaku merged 3 commits intomainfrom
tie-embed-conversion-fix
Feb 26, 2026
Merged

Tie-embed-conversion-fix#454
HenryNdubuaku merged 3 commits intomainfrom
tie-embed-conversion-fix

Conversation

@ncylich
Copy link
Copy Markdown
Collaborator

@ncylich ncylich commented Feb 25, 2026

Renamed ambiguous configs in hf conversion and added checks for both root_config and config to retrieve tie embeddings in accordance with the new Transformers 5.0+ api.

Uses hard links to tie LM head to the embedding weights, eliminating all redundant/wasteful storage use

Copilot AI review requested due to automatic review settings February 25, 2026 22:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the HuggingFace model conversion code by clarifying config variable names and implementing efficient embedding weight tying. The changes rename ambiguous config variables, add fallback logic for retrieving tie_word_embeddings to support Transformers 5.0+, and use hard links instead of duplicating storage for tied embeddings.

Changes:

  • Renamed config to root_config and cfg to config for clarity in distinguishing between root-level and text-specific configurations
  • Added fallback logic to check both config and root_config for tie_word_embeddings field
  • Replaced duplicate weight storage with hard links when embeddings are tied

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: Noah Cylich <[email protected]>
@HenryNdubuaku HenryNdubuaku merged commit 356f224 into main Feb 26, 2026
1 of 2 checks passed
cattermelon1234 pushed a commit to cattermelon1234/cactus that referenced this pull request Feb 28, 2026
* fixed tie embedding bug and improved embedding weight saving

Signed-off-by: Noah Cylich <[email protected]>

* improved variable naming

Signed-off-by: Noah Cylich <[email protected]>

* added log

Signed-off-by: Noah Cylich <[email protected]>

---------

Signed-off-by: Noah Cylich <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants