Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,23 @@
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
generation_config = GenerationConfig.from_pretrained(MODEL_ID)
config = Glm4MoeConfig(
vocab_size=len(tokenizer.vocab),
vocab_size=151365,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hardcoded vocab_size deviates from pattern and likely incorrect

Medium Severity

vocab_size=151365 is hardcoded instead of using len(tokenizer.vocab) like every other tiny model generation script in the repository. The PR description's "after" diff output shows vocab_size is no longer a difference between the reference (151552) and the tiny model — implying the value was expected to match the reference. However, 151365 doesn't match 151552, suggesting the hardcoded value is stale. Using len(tokenizer.vocab) would dynamically produce the correct value and stay consistent with all sibling scripts.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 49d5fca. Configure here.

hidden_size=8,
num_attention_heads=4,
num_key_value_heads=2,
num_hidden_layers=2,
intermediate_size=32,
moe_intermediate_size=32,
head_dim=2,
n_routed_experts=4,
num_experts_per_tok=2,
attention_bias=True,
eos_token_id=[151329, 151336, 151338],
pad_token_id=151329,
rope_theta=1000000,
routed_scaling_factor=2.5,
use_qk_norm=True,
num_nextn_predict_layers=1,
)
model = Glm4MoeForCausalLM(config).to(dtype=torch.bfloat16)
init_weights_tiny_model(model)
Expand Down
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

MODEL_REVISIONS = {
# Add model_id: revision mappings here to test PRs
"trl-internal-testing/tiny-Glm4MoeForCausalLM": "refs/pr/1",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Temporary MODEL_REVISIONS entry left in conftest

High Severity

The MODEL_REVISIONS dict contains a temporary entry "trl-internal-testing/tiny-Glm4MoeForCausalLM": "refs/pr/1" that is meant for CI testing only. The comments directly above (lines 25–29) document a 4-step workflow where step 4 is "Remove the entry from this dict and commit." If this PR is merged as-is, all tests loading this model will permanently pull from refs/pr/1 instead of the main branch, which is fragile and incorrect once the Hub PR is merged.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 540502a. Configure here.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid pinning tests to a Hub PR ref

MODEL_REVISIONS now forces every from_pretrained("trl-internal-testing/tiny-Glm4MoeForCausalLM") call to use refs/pr/1, which is a temporary Hub PR reference rather than an immutable release revision. Because tests/conftest.py applies this autouse fixture globally, CI (including the full make test jobs in .github/workflows/tests.yml) becomes dependent on that PR ref staying available and unchanged; if the Hub PR is closed/rebased/removed, unrelated test runs will start failing. This should be removed after the model PR merge or replaced with a stable revision pin.

Useful? React with 👍 / 👎.

}


Expand Down
18 changes: 2 additions & 16 deletions tests/test_chat_template_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,7 @@ class TestSupportsToolCalling:
reason="Gemma4 models were introduced in transformers-5.5.0",
),
),
pytest.param(
"trl-internal-testing/tiny-Glm4MoeForCausalLM",
id="glm4moe",
marks=pytest.mark.skipif(
Version(transformers.__version__) < Version("5.0.0"),
reason="GLM4 tokenizer requires transformers>=5.0.0",
),
),
pytest.param("trl-internal-testing/tiny-Glm4MoeForCausalLM", id="glm4moe"),
pytest.param("trl-internal-testing/tiny-GptOssForCausalLM", id="gptoss"),
pytest.param("trl-internal-testing/tiny-LlamaForCausalLM-3.1", id="llama3.1"),
pytest.param("trl-internal-testing/tiny-LlamaForCausalLM-3.2", id="llama3.2"),
Expand Down Expand Up @@ -441,14 +434,7 @@ def test_prefix_preserving_template_processor(self):
pytest.param("trl-internal-testing/tiny-DeepseekV3ForCausalLM", id="deepseekv3"),
pytest.param("trl-internal-testing/tiny-GemmaForCausalLM", id="gemma"),
pytest.param("trl-internal-testing/tiny-Gemma2ForCausalLM", id="gemma2"),
pytest.param(
"trl-internal-testing/tiny-Glm4MoeForCausalLM",
id="glm4moe",
marks=pytest.mark.skipif(
Version(transformers.__version__) < Version("5.0.0"),
reason="GLM4 tokenizer requires transformers>=5.0.0",
),
),
pytest.param("trl-internal-testing/tiny-Glm4MoeForCausalLM", id="glm4moe"),
pytest.param("trl-internal-testing/tiny-GptOssForCausalLM", id="gptoss"),
pytest.param("trl-internal-testing/tiny-LlamaForCausalLM-3", id="llama3"),
pytest.param("trl-internal-testing/tiny-Phi3ForCausalLM-3", id="phi3"),
Expand Down
8 changes: 1 addition & 7 deletions tests/test_data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,13 +530,7 @@ class TestApplyChatTemplate(TrlTestCase):
"trl-internal-testing/tiny-Gemma2ForCausalLM",
"trl-internal-testing/tiny-GemmaForCausalLM",
"trl-internal-testing/tiny-GptOssForCausalLM",
pytest.param(
"trl-internal-testing/tiny-Glm4MoeForCausalLM",
marks=pytest.mark.skipif(
Version(transformers.__version__) < Version("5.0.0"),
reason="GLM4 tokenizer requires transformers>=5.0.0",
),
),
"trl-internal-testing/tiny-Glm4MoeForCausalLM",
"trl-internal-testing/tiny-LlamaForCausalLM-3.1",
"trl-internal-testing/tiny-LlamaForCausalLM-3.2",
"trl-internal-testing/tiny-LlamaForCausalLM-3",
Expand Down
8 changes: 1 addition & 7 deletions tests/test_sft_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,13 +355,7 @@ def test_init_with_training_arguments(self):
"model_id",
[
"trl-internal-testing/tiny-Cohere2ForCausalLM",
pytest.param(
"trl-internal-testing/tiny-Glm4MoeForCausalLM",
marks=pytest.mark.skipif(
Version(transformers.__version__) < Version("5.0.0"),
reason="GLM4 tokenizer requires transformers>=5.0.0",
),
),
"trl-internal-testing/tiny-Glm4MoeForCausalLM",
"trl-internal-testing/tiny-GptOssForCausalLM",
"trl-internal-testing/tiny-Qwen2ForCausalLM-2.5",
"trl-internal-testing/tiny-Qwen3MoeForCausalLM",
Expand Down
Loading