TRF065

Processors must not subclass ImagesKwargs, TextKwargs, AudioKwargs or VideosKwargs; declare model kwargs at the top level of <Model>ProcessorKwargs.

   
Default Enabled
Scope All models
Source mlinter/trf065.py
Show in terminal mlinter --rule TRF065

What it does

In processing_*.py, flags any class extending ImagesKwargs, TextKwargs, AudioKwargs or VideosKwargs, directly or through another model’s subclass. In modular_*.py, which also holds sub-processors, a subclass is allowed when named <Model>ImageProcessorKwargs, <Model>VideoProcessorKwargs, <Model>VideoProcessorInitKwargs or <Model>AudioProcessorKwargs.

Why is this bad?

Modality kwargs belong in the sub-processor files (image_processing_*.py, video_processing_*.py, …). In processing_*.py they stay untyped, since sub-processors are loaded dynamically.

Example

-class AcmeImagesKwargs(ImagesKwargs, total=False):
-    num_crops: int
-
-
 class AcmeProcessorKwargs(ProcessingKwargs, total=False):
-    images_kwargs: AcmeImagesKwargs
+    num_crops: int

Suppressing this rule

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

4 models are exempt from TRF065 in mlinter/rules.toml, because they predate the convention and cannot be changed without breaking backward compatibility.

Show the 4 allowlisted models
  • csm
  • dia
  • pocket_tts
  • voxtral