[don't merge] check mlinter - #47774
Conversation
Empty @add_start_docstrings("") on Kosmos2_5Model to verify mlinter runs in CI.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
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. |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…er is merged Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Model linter — first pass
transformers-mlinter found 5 item(s) in the model files this PR touches. These are structural conventions a maintainer would otherwise flag by hand.
This is automated and advisory — it does not block merging.
| rule | count | what it checks |
|---|---|---|
TRF034 |
2 | Layer classes held in an nn.ModuleList must subclass GradientCheckpointingLayer. |
TRF029 |
1 | A module taking config must not also take arguments that live on the config. |
TRF020 |
1 | MLA models must isolate the KV LoRA expansion (kv_b_proj) in a dedicated method that forward() calls. |
TRF008 |
1 | Doc decorators on PreTrainedModel classes should avoid empty add_start_docstrings usage. |
4 item(s) outside this diff
src/transformers/models/axk2/modular_axk2.py:202TRF029 — TRF029:AXK2GatedRMSNorm.__init__takesconfigand alsoeps. Read those off the config inside the module so there is one source of truth.src/transformers/models/axk2/modular_axk2.py:314TRF020 — TRF020: AXK2Attention declares the KV LoRA expansionself.kv_b_projbut forward does not call a dedicated expansion method. Move the expansion into a method (e.g.expand_kv(k_nope, k_pe) -> key_states, value_states) and call it from forward, so external backends (vLLM/SGLang) can override it and consume the compressed KV cache directly.src/transformers/models/granite_swa/modular_granite_swa.py:246TRF034 — TRF034:GraniteSWADecoderLayeris stacked in annn.ModuleListbut does not subclassGradientCheckpointingLayer, so gradient checkpointing silently skips it.src/transformers/models/granitemoe_swa/modular_granitemoe_swa.py:180TRF034 — TRF034:GraniteMoeSWADecoderLayeris stacked in annn.ModuleListbut does not subclassGradientCheckpointingLayer, so gradient checkpointing silently skips it.
| @@ -1136,9 +1136,7 @@ def forward( | |||
|
|
|||
|
|
|||
| @add_start_docstrings( | |||
There was a problem hiding this comment.
TRF008 — TRF008: Kosmos2_5Model uses add_start_docstrings without non-empty docstring arguments.
Why this matters
Empty decorator usage produces unclear docs and weakens generated API documentation quality.
-@add_start_docstrings("")
+@add_start_docstrings("The Acme model.")
class AcmeModel(AcmePreTrainedModel):
...Suppress with # trf-ignore: TRF008 if intentional.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Model linter — first pass
transformers-mlinter found 5 item(s) in the model files this PR touches. These are structural conventions a maintainer would otherwise flag by hand.
This is automated and advisory — it does not block merging.
| rule | count | what it checks |
|---|---|---|
TRF034 |
2 | Layer classes held in an nn.ModuleList must subclass GradientCheckpointingLayer. |
TRF029 |
1 | A module taking config must not also take arguments that live on the config. |
TRF020 |
1 | MLA models must isolate the KV LoRA expansion (kv_b_proj) in a dedicated method that forward() calls. |
TRF008 |
1 | Doc decorators on PreTrainedModel classes should avoid empty add_start_docstrings usage. |
4 item(s) outside this diff
src/transformers/models/axk2/modular_axk2.py:202TRF029 — TRF029:AXK2GatedRMSNorm.__init__takesconfigand alsoeps. Read those off the config inside the module so there is one source of truth.src/transformers/models/axk2/modular_axk2.py:314TRF020 — TRF020: AXK2Attention declares the KV LoRA expansionself.kv_b_projbut forward does not call a dedicated expansion method. Move the expansion into a method (e.g.expand_kv(k_nope, k_pe) -> key_states, value_states) and call it from forward, so external backends (vLLM/SGLang) can override it and consume the compressed KV cache directly.src/transformers/models/granite_swa/modular_granite_swa.py:246TRF034 — TRF034:GraniteSWADecoderLayeris stacked in annn.ModuleListbut does not subclassGradientCheckpointingLayer, so gradient checkpointing silently skips it.src/transformers/models/granitemoe_swa/modular_granitemoe_swa.py:180TRF034 — TRF034:GraniteMoeSWADecoderLayeris stacked in annn.ModuleListbut does not subclassGradientCheckpointingLayer, so gradient checkpointing silently skips it.
| @@ -1136,9 +1136,7 @@ def forward( | |||
|
|
|||
|
|
|||
| @add_start_docstrings( | |||
There was a problem hiding this comment.
TRF008 — TRF008: Kosmos2_5Model uses add_start_docstrings without non-empty docstring arguments.
Why this matters
Empty decorator usage produces unclear docs and weakens generated API documentation quality.
-@add_start_docstrings("")
+@add_start_docstrings("The Acme model.")
class AcmeModel(AcmePreTrainedModel):
...Suppress with # trf-ignore: TRF008 if intentional.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Model linter — first pass
transformers-mlinter found 5 item(s) in the model files this PR touches. These are structural conventions a maintainer would otherwise flag by hand.
This is automated and advisory — it does not block merging.
| rule | count | what it checks |
|---|---|---|
TRF034 |
2 | Layer classes held in an nn.ModuleList must subclass GradientCheckpointingLayer. |
TRF029 |
1 | A module taking config must not also take arguments that live on the config. |
TRF020 |
1 | MLA models must isolate the KV LoRA expansion (kv_b_proj) in a dedicated method that forward() calls. |
TRF008 |
1 | Doc decorators on PreTrainedModel classes should avoid empty add_start_docstrings usage. |
4 item(s) outside this diff
src/transformers/models/axk2/modular_axk2.py:202TRF029 — TRF029:AXK2GatedRMSNorm.__init__takesconfigand alsoeps. Read those off the config inside the module so there is one source of truth.src/transformers/models/axk2/modular_axk2.py:314TRF020 — TRF020: AXK2Attention declares the KV LoRA expansionself.kv_b_projbut forward does not call a dedicated expansion method. Move the expansion into a method (e.g.expand_kv(k_nope, k_pe) -> key_states, value_states) and call it from forward, so external backends (vLLM/SGLang) can override it and consume the compressed KV cache directly.src/transformers/models/granite_swa/modular_granite_swa.py:246TRF034 — TRF034:GraniteSWADecoderLayeris stacked in annn.ModuleListbut does not subclassGradientCheckpointingLayer, so gradient checkpointing silently skips it.src/transformers/models/granitemoe_swa/modular_granitemoe_swa.py:180TRF034 — TRF034:GraniteMoeSWADecoderLayeris stacked in annn.ModuleListbut does not subclassGradientCheckpointingLayer, so gradient checkpointing silently skips it.
| @@ -1136,9 +1136,7 @@ def forward( | |||
|
|
|||
|
|
|||
| @add_start_docstrings( | |||
There was a problem hiding this comment.
TRF008 — TRF008: Kosmos2_5Model uses add_start_docstrings without non-empty docstring arguments.
Why this matters
Empty decorator usage produces unclear docs and weakens generated API documentation quality.
-@add_start_docstrings("")
+@add_start_docstrings("The Acme model.")
class AcmeModel(AcmePreTrainedModel):
...Suppress with # trf-ignore: TRF008 if intentional.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Model linter — first pass
transformers-mlinter found 5 item(s) in the model files this PR touches. These are structural conventions a maintainer would otherwise flag by hand.
This is automated and advisory — it does not block merging.
| rule | count | what it checks |
|---|---|---|
TRF034 |
2 | Layer classes held in an nn.ModuleList must subclass GradientCheckpointingLayer. |
TRF029 |
1 | A module taking config must not also take arguments that live on the config. |
TRF020 |
1 | MLA models must isolate the KV LoRA expansion (kv_b_proj) in a dedicated method that forward() calls. |
TRF008 |
1 | Doc decorators on PreTrainedModel classes should avoid empty add_start_docstrings usage. |
4 item(s) outside this diff
src/transformers/models/axk2/modular_axk2.py:202TRF029 — TRF029:AXK2GatedRMSNorm.__init__takesconfigand alsoeps. Read those off the config inside the module so there is one source of truth.src/transformers/models/axk2/modular_axk2.py:314TRF020 — TRF020: AXK2Attention declares the KV LoRA expansionself.kv_b_projbut forward does not call a dedicated expansion method. Move the expansion into a method (e.g.expand_kv(k_nope, k_pe) -> key_states, value_states) and call it from forward, so external backends (vLLM/SGLang) can override it and consume the compressed KV cache directly.src/transformers/models/granite_swa/modular_granite_swa.py:246TRF034 — TRF034:GraniteSWADecoderLayeris stacked in annn.ModuleListbut does not subclassGradientCheckpointingLayer, so gradient checkpointing silently skips it.src/transformers/models/granitemoe_swa/modular_granitemoe_swa.py:180TRF034 — TRF034:GraniteMoeSWADecoderLayeris stacked in annn.ModuleListbut does not subclassGradientCheckpointingLayer, so gradient checkpointing silently skips it.
| @@ -1136,9 +1137,7 @@ def forward( | |||
|
|
|||
|
|
|||
| @add_start_docstrings( | |||
There was a problem hiding this comment.
TRF008 — TRF008: Kosmos2_5Model uses add_start_docstrings without non-empty docstring arguments.
Why this matters
Empty decorator usage produces unclear docs and weakens generated API documentation quality.
-@add_start_docstrings("")
+@add_start_docstrings("The Acme model.")
class AcmeModel(AcmePreTrainedModel):
...Suppress with # trf-ignore: TRF008 if intentional.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ew review" This reverts commit 8c19e2a.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Model linter — first pass
transformers-mlinter found 6 item(s) in the model files this PR touches. These are structural conventions a maintainer would otherwise flag by hand.
This is automated and advisory — it does not block merging.
| rule | count | what it checks |
|---|---|---|
TRF034 |
2 | Layer classes held in an nn.ModuleList must subclass GradientCheckpointingLayer. |
TRF004 |
1 | Models must never override tie_weights. Use _tied_weights_keys instead. |
TRF029 |
1 | A module taking config must not also take arguments that live on the config. |
TRF020 |
1 | MLA models must isolate the KV LoRA expansion (kv_b_proj) in a dedicated method that forward() calls. |
TRF008 |
1 | Doc decorators on PreTrainedModel classes should avoid empty add_start_docstrings usage. |
4 item(s) outside this diff
src/transformers/models/axk2/modular_axk2.py:202TRF029 — TRF029:AXK2GatedRMSNorm.__init__takesconfigand alsoeps. Read those off the config inside the module so there is one source of truth.src/transformers/models/axk2/modular_axk2.py:314TRF020 — TRF020: AXK2Attention declares the KV LoRA expansionself.kv_b_projbut forward does not call a dedicated expansion method. Move the expansion into a method (e.g.expand_kv(k_nope, k_pe) -> key_states, value_states) and call it from forward, so external backends (vLLM/SGLang) can override it and consume the compressed KV cache directly.src/transformers/models/granite_swa/modular_granite_swa.py:246TRF034 — TRF034:GraniteSWADecoderLayeris stacked in annn.ModuleListbut does not subclassGradientCheckpointingLayer, so gradient checkpointing silently skips it.src/transformers/models/granitemoe_swa/modular_granitemoe_swa.py:180TRF034 — TRF034:GraniteMoeSWADecoderLayeris stacked in annn.ModuleListbut does not subclassGradientCheckpointingLayer, so gradient checkpointing silently skips it.
| "attentions": AlbertAttention, | ||
| } | ||
|
|
||
| def tie_weights(self): # intentional TRF004 violation for testing |
There was a problem hiding this comment.
TRF004 — TRF004: AlbertPreTrainedModel overrides tie_weights. Use _tied_weights_keys class attribute to declare tied weights instead.
Why this matters
Overriding tie_weights leads to bad consequences for loading, device_map computation, and saving. Use _tied_weights_keys class attribute to declare tied weights instead.
-def tie_weights(self):
- self.lm_head.weight = self.emb.weight
+class AcmeForCausalLM(AcmePreTrainedModel):
+ _tied_weights_keys = ["lm_head.weight"]Suppress with # trf-ignore: TRF004 if intentional.
| @@ -1136,9 +1137,7 @@ def forward( | |||
|
|
|||
|
|
|||
| @add_start_docstrings( | |||
There was a problem hiding this comment.
TRF008 — TRF008: Kosmos2_5Model uses add_start_docstrings without non-empty docstring arguments.
Why this matters
Empty decorator usage produces unclear docs and weakens generated API documentation quality.
-@add_start_docstrings("")
+@add_start_docstrings("The Acme model.")
class AcmeModel(AcmePreTrainedModel):
...Suppress with # trf-ignore: TRF008 if intentional.
…r now Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
[For maintainers] Suggested jobs to run (before merge) run-slow: albert, kosmos2_5 |
…_init for now" This reverts commit 5b45bb1.
CI recapDashboard: View test results in Grafana
|
Summary
modeling_kosmos2_5.py(empty@add_start_docstrings("")) to verify thattransformers-mlinterruns correctly viamake check-code-qualityin CI.Test plan
check_code_qualityjob should fail on theModeling file structurestep with a TRF008 error🤖 mlinter review state
c26b97631b623ffe