TRF065

Processors must not subclass ImagesKwargs, TextKwargs, AudioKwargs or VideosKwargs. Declare model-specific 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. A modular file also holds image, video and audio processors, which may extend the shared kwargs, so there a subclass must be named <Model>ImageProcessorKwargs (for ImagesKwargs), <Model>VideoProcessorKwargs/<Model>VideoProcessorInitKwargs (for VideosKwargs) or <Model>AudioProcessorKwargs (for AudioKwargs); TextKwargs subclasses are always flagged.

Why is this bad?

Modality kwargs must be defined in the sub-processor files (image_processing_*.py, video_processing_*.py, etc.). In processing_*.py the modality kwargs remain untyped as they cannot be statically known due to dynamic sub-processor loading at runtime.

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