TRF002

base_model_prefix on a PreTrainedModel, when set, should be a non-empty canonical string.

   
Default Enabled
Scope All models
Source mlinter/trf002.py
Show in terminal mlinter --rule TRF002

What it does

Checks base_model_prefix is a non-empty, whitespace-free string literal.

Why is this bad?

Invalid prefixes can break weight-loading key mapping and base-model access.

Example

 class AcmePreTrainedModel(PreTrainedModel):
-    base_model_prefix = ""
+    base_model_prefix = "model"

Suppressing this rule

Add a # trf-ignore: TRF002 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.

Allowlisted models

1 model are exempt from TRF002 in mlinter/rules.toml, because they predate the convention and cannot be changed without breaking backward compatibility.

Show the 1 allowlisted model
  • lighton_ocr