TRF015
Models with non-empty _tied_weights_keys must have tie_word_embeddings in their Config.
| Default | Enabled |
| Scope | All models |
| Source | mlinter/trf015.py |
| Show in terminal | mlinter --rule TRF015 |
What it does
When a PreTrainedModel subclass sets a non-empty _tied_weights_keys, checks the companion configuration file for a tie_word_embeddings field.
Why is this bad?
Without it users cannot control weight tying: the model ties unconditionally, breaking serialization round-trips and fine-tuning with untied heads.
Example
# configuration_foo.py
@strict(accept_kwargs=True)
class FooConfig(PreTrainedConfig):
hidden_size: int = 768
+ tie_word_embeddings: bool = True
Suppressing this rule
Add a # trf-ignore: TRF015 comment on the flagged line or the line directly above it. See Suppressing rules for whole-file directives and when a suppression is the wrong answer.
