chore(linter): fixes for rule 16#46023
Conversation
|
run-slow: albert, align, altclip, autoformer, bit, blt, bridgetower, chinese_clip, clap, clip, clipseg, clvp, colmodernvbert, colpali, colqwen2, conditional_detr |
|
This comment contains models: ["models/albert", "models/align", "models/altclip", "models/autoformer", "models/bit", "models/blt", "models/bridgetower", "models/chinese_clip", "models/clap", "models/clip", "models/clipseg", "models/clvp", "models/colmodernvbert", "models/colpali", "models/colqwen2", "models/conditional_detr"] |
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
vasqu
left a comment
There was a problem hiding this comment.
I'm good with the current changes.
It kind of remains how we want to handle TRF 018: Imo, it would make sense to call this in any case - the performance loss is negligible for much cleaner modular paths in the future; any init already covered in the super can be overwritten anyway. But I'm not sure what @zucchini-nlp meant with the weird init patterns because they probably have been removed (by limiting the model scope) --> is there anything that would interfere? Maybe we could even remove some small overrides if they already do what the super call does
aba4f5d to
e381a40
Compare
| image_std = [1.0, 1.0, 1.0] | ||
| size = None | ||
| default_to_square = True | ||
| do_convert_rgb = True |
There was a problem hiding this comment.
why is it being removed btw? i see a few more deletes below for do pad, resize
There was a problem hiding this comment.
I think that's TRF016 kicking in here, it's not referenced. Maybe we need more edge cases?
There was a problem hiding this comment.
hmm indeed, prob they assumed it happens automatically outside prerpcessor, because that is how image processing works. I will pass by processing changes one-by-one to verify it can actually be deleted then
zucchini-nlp
left a comment
There was a problem hiding this comment.
Re init weights thing, i followed the slack thread with Cyril and prob misunderstood that init weights once via super will set the flag on the weight already. Since it can be init correctly even after calling super, I am fine with it
My only q is about deleted do_xxx in some processors. Maybe we can split into 3 PRs for each rule, imo we don't need to PR small subsets of models if we are happy with calling super().init_weights always
cf5ea7b to
6ed253d
Compare
|
[For maintainers] Suggested jobs to run (before merge) run-slow: gemma4, glm46v, glm4v, glmga, kosmos2_5, llama4, mask2former, maskformer, minicpmv4_6, mllama, oneformer, perception_lm, phi4_multimodal, qwen2_vl, qwen3_vl, video_llama_3 |
|
run-slow: gemma4, glm46v, glm4v, glmga, kosmos2_5, llama4, mask2former, maskformer, minicpmv4_6, mllama, oneformer, perception_lm, phi4_multimodal, qwen2_vl, qwen3_vl, video_llama_3 |
|
This comment contains models: ["models/gemma4", "models/glm46v", "models/glm4v", "models/glmga", "models/kosmos2_5", "models/llama4", "models/mask2former", "models/maskformer", "models/minicpmv4_6", "models/mllama", "models/oneformer", "models/perception_lm", "models/phi4_multimodal", "models/qwen2_vl", "models/qwen3_vl", "models/video_llama_3"] |
CI ResultsCommit Info
The test failure analysis could not be completed. Please check the workflow run for details. |
zucchini-nlp
left a comment
There was a problem hiding this comment.
A few comments and lets' revert unrelated commits
| + tie_word_embeddings: bool = True | ||
| ``` | ||
|
|
||
| ### TRF016 |
There was a problem hiding this comment.
i suppose the docs contains unrelated changes
There was a problem hiding this comment.
changes in this file and rules.toml will be removed from the patch. we just want to make the code base rule-16-compatible so we can update mlinter to the next release in another patch
| do_resize = True | ||
| do_rescale = True | ||
| do_normalize = True | ||
| do_convert_rgb = True |
There was a problem hiding this comment.
seeing all video processors don't use donvert_rgb. I suppose the contribs assumed it gets caught up internally
imo we have to keep the flag and make sure it is actually used. We need to squeeze it in here:
if do_convert_rgb:
video = self.convert_to_rgb(video)
transformers/src/transformers/video_processing_utils.py
Lines 321 to 324 in 4557092
| image_mean = [0.5, 0.5, 0.5] | ||
| image_std = [0.5, 0.5, 0.5] | ||
| size = {"height": 336, "width": 336} | ||
| do_resize = True |
There was a problem hiding this comment.
can we TRF ignore it? imo it is meant to always resize and we can actually check if do_resize=False and raise an error that it cannot be False, otherwise the output pixel values cannot be tensorized
| do_rescale = True | ||
| do_normalize = True | ||
| default_to_square = False | ||
| do_center_crop = False |
There was a problem hiding this comment.
can also delete crop_size = None, same for PIL backend
What does this PR do?
Adds support for rules 16