TRF064
<Model>ProcessorKwargs must not override _defaults or the modality kwargs; set defaults as class attributes of the processor.
| Default | Enabled |
| Scope | All models |
| Source | mlinter/trf064.py |
| Show in terminal | mlinter --rule TRF064 |
What it does
In processing_*.py and modular_*.py, flags a ProcessingKwargs subclass that assigns or re-annotates _defaults, text_kwargs, images_kwargs, videos_kwargs or audio_kwargs.
Why is this bad?
ProcessingKwargs._defaults is deprecated: defaults are class attributes of the processor, inherited and overridden like any other. The modality fields keep their default types, because the available arguments are only known once sub-processors are loaded at runtime.
Example
class AcmeProcessorKwargs(ProcessingKwargs, total=False):
- images_kwargs: AcmeImagesKwargs
- _defaults = {
- "text_kwargs": {"padding": False},
- "images_kwargs": {"num_crops": 4},
- }
+ num_crops: int
class AcmeProcessor(ProcessorMixin):
valid_processor_kwargs = AcmeProcessorKwargs
+ text_kwargs = {"padding": False}
+ num_crops: int = 4
Suppressing this rule
Add a # trf-ignore: TRF064 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
5 models are exempt from TRF064 in mlinter/rules.toml, because they predate the convention and cannot be changed without breaking backward compatibility.
Show the 5 allowlisted models
csmdiaemu3pocket_ttsvoxtral
