fix(processing): Filter kwargs in ProcessorMixin call to prevent Type…#41606
Open
CodersAcademy006 wants to merge 2 commits intohuggingface:mainfrom
Open
fix(processing): Filter kwargs in ProcessorMixin call to prevent Type…#41606CodersAcademy006 wants to merge 2 commits intohuggingface:mainfrom
CodersAcademy006 wants to merge 2 commits intohuggingface:mainfrom
Conversation
Member
|
cc @zucchini-nlp! I'm not sure about this because some of the submodules may just have |
Comment on lines
628
to
-629
| input_data, input_kwargs = attribute_to_kwargs[attribute_name] | ||
| if input_data is not None and attribute is not None: | ||
| attribute_output = attribute(input_data, **kwargs[input_kwargs]) |
Member
There was a problem hiding this comment.
in this line kwargs are filtered already and we are obtaining kwargs[input_kwargs]. That should work for all models if if there's a TypeError anywhere, I'd suggest to see what has gone wrong with specific model
There was a problem hiding this comment.
The model where this issue is occurring is CSM-1B, so it might be related to how that particular architecture handles its input kwargs.
Contributor
|
View the CircleCI Test Summary for this PR: https://huggingface.co/spaces/transformers-community/circle-ci-viz?pr=41606&sha=987d5c |
This was referenced Apr 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes an issue where multimodal processors could raise a
TypeErrorwhen called with arguments specific to one modality. TheProcessorMixin.__call__method was passing all keyword arguments to each sub-processor (tokenizer, feature extractor, etc.), causing a crash if a processor received an argument it didn't recognize (e.g.,EncodecFeatureExtractorreceivingpad_to_multiple_offrom the tokenizer).This fix resolves the problem by filtering the keyword arguments before they are passed to each sub-processor. It uses Python's
inspectmodule to get the valid parameters for each processor's__call__method and only passes the arguments that match. This preventsTypeErrors and makes the processor logic more robust.Fixes #41598