Skip to content

Conversation

@zRzRzRzRzRzRzR
Copy link
Contributor

  • Fixed weight conversion issues for some model providers and removed some debug logs
  • Simplified some functions

@zRzRzRzRzRzRzR zRzRzRzRzRzRzR changed the title 4.1V 模型和 GLM-4.5V模型转换代码更新 4.1V Model and GLM-4.5V Model Conversion Code Updates Oct 22, 2025
@Rocketknight1
Copy link
Member

Hi, is there a reference somewhere for the issues this is fixing?

@zRzRzRzRzRzRzR
Copy link
Contributor Author

No, but I encountered some bugs when converting the open-source model at https://github.com/thu-coai/Glyph, so I fixed them here together.
The internal weights have not been publicly released and are only obtained by the official team and provider, so there won't be any issues for converting to code that supports the transformers library.

Copy link
Member

Choose a reason for hiding this comment

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

Let's delete all the test files

"n_shared_experts": text_config.get("n_shared_experts", 1),
"norm_topk_prob": text_config.get("norm_topk_prob", True),
"num_experts_per_tok": text_config.get("num_experts_per_tok", 8),
"rope_scaling": {"type": "default", "mrope_section": [8, 12, 12]},
Copy link
Member

Choose a reason for hiding this comment

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

In the main branch it is now called rope_parameters and also includes the theta inside the dict. So maybe

"rope_scaling": {"rope_type": "default", "rope_theta": 10000.0, "mrope_section": [8, 12, 12]},

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've pushed the updates, is this how I understood it?

Copy link
Member

@zucchini-nlp zucchini-nlp left a comment

Choose a reason for hiding this comment

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

Thanks, I didn't review in detail and I will trust it converts correctly from the original format. Just left a few nits about config attributes naming

@@ -1,4 +1,3 @@
# coding=utf-8
Copy link
Member

Choose a reason for hiding this comment

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

accidental deletion?

"rope_theta": model_config.get("rotary_base", 10000.0),
"image_token_id": model_config.get("image_token_id", 151363),
"video_token_id": model_config.get("video_token_id", 151364),
"tie_word_embeddings": False,
Copy link
Member

Choose a reason for hiding this comment

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

this one is also part of text config

"use_cache": text_config.get("use_cache", True),
"vocab_size": text_config.get("vocab_size", 151552),
"partial_rotary_factor": 0.5,
"rope_scaling": {"rope_type": "default", "rope_theta": 10000.0, "mrope_section": [8, 12, 12]},
Copy link
Member

Choose a reason for hiding this comment

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

lets' call this key rope_parameters to align with recent changes

"video_token_id": model_config.get("video_token_id", 151344),
"image_token_id": model_config.get("image_token_id", 151363),
"video_token_id": model_config.get("video_token_id", 151364),
"tie_word_embeddings": False,
Copy link
Member

Choose a reason for hiding this comment

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

same here for tie_word_embeddings and rope_parameters

@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

[For maintainers] Suggested jobs to run (before merge)

run-slow: glm4v, glm4v_moe

@zucchini-nlp
Copy link
Member

Thanks, lets merge!

@zucchini-nlp zucchini-nlp enabled auto-merge (squash) November 7, 2025 10:27
@zucchini-nlp zucchini-nlp merged commit a127710 into huggingface:main Nov 7, 2025
14 checks passed
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@zRzRzRzRzRzRzR zRzRzRzRzRzRzR deleted the glm-46 branch November 7, 2025 10:52
Abdennacer-Badaoui pushed a commit to Abdennacer-Badaoui/transformers that referenced this pull request Nov 10, 2025
)

* update for new model convert

* Update convert_glm4v_moe_mgt_weights_to_hf.py

* restore

* Update convert_glm4v_mgt_weights_to_hf.py

* update

* 1

* Update convert_glm4v_moe_mgt_weights_to_hf.py

* Update convert_glm4v_mgt_weights_to_hf.py

* finish

* update

* 2

* 2

* 1

* Update convert_glm4v_moe_mgt_weights_to_hf.py

* update

* update with tie_word_embeddings place
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.

4 participants