-
Notifications
You must be signed in to change notification settings - Fork 30.6k
[Llama4] Remove image_sizes
arg and deprecate vision_feature_layer
#40832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
if pixel_values is not None: | ||
image_features = self.get_image_features( | ||
pixel_values=pixel_values, | ||
vision_feature_layer=vision_feature_layer, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vision_feature_layer
is also not used in get_image_features
and thus not necessary. Should I remove it, since we have kwargs here which should consume that whenever passed thus not breaking BC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep sounds good IMO 😉
cc @zucchini-nlp as well |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a bad copy from Llava, and can be simply removed. I don't expect anyone to be using vision_feature_layer
, so let's just remove it since it is inn utility method
@zucchini-nlp It's also an arg in forward and present in config as well, shall I remove from forward too, removing from config would be breaking. Otherwise def can only remove from utility func. |
Ahh I see, then we can do a tiny deprecation cycle of 1 minor release. Prob ir was also serialized in config in which case it will be still available with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, not sure about the warning because if we pushed this to the hub, it is probably something users can do nothing about. We don't need a warning as the arg will always be read in **kwargs
@ArthurZucker Then you are suggesting that, we remove the arg from config completely (will be read in kwargs for all hub configs) and add the deprecate decorator in modeling file? |
self.rope_theta = rope_theta | ||
|
||
if not self.vision_feature_layer: | ||
logger.warning("`vision_feature_layer` is deprecated and will be removed in v4.58") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we just need warning when users try to get the attribute or set to a different value, letting them know that vision_feature_layer
has no effect on model
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zucchini-nlp A code suggestion or reference would be better here. I can only think of a niave way to have getter and setter funcs for vision_feature_layer attr and raise a warning like you mentioned (instead of general warning) or is there a util func or decorator which can be used ootb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Smth like this
transformers/src/transformers/models/gemma3/configuration_gemma3.py
Lines 240 to 251 in 3fd456b
@property | |
def sliding_window_pattern(self): | |
warnings.warn( | |
"The `sliding_window_pattern` attribute is deprecated and will be removed in v4.55.0.", | |
FutureWarning, | |
) | |
return self._sliding_window_pattern | |
@sliding_window_pattern.setter | |
def sliding_window_pattern(self, value): | |
self._sliding_window_pattern = value | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, the generation test will be fixed soon and is not related :)
Lets rebase and merge :) |
[For maintainers] Suggested jobs to run (before merge) run-slow: llama4 |
image_sizes
arg and deprecate vision_feature_layer
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. |
huggingface#40832) * Remove unused arg * deprecate * revrt one change * get set go * version correction * fix * make style * comment
huggingface#40832) * Remove unused arg * deprecate * revrt one change * get set go * version correction * fix * make style * comment
huggingface#40832) * Remove unused arg * deprecate * revrt one change * get set go * version correction * fix * make style * comment
As per the titles, simply removes image_size arg from Llama4's forward method as it's unused and deprecates vision_feature_layer arg.
@ArthurZucker for review