mirror of
https://github.com/huggingface/transformers.git
synced 2025-08-01 02:31:11 +06:00
Processors: don't default padding side (#33942)
* don't default padding side * fix
This commit is contained in:
parent
a3add29097
commit
0dbc7090ba
@ -235,9 +235,6 @@ class Idefics3Processor(ProcessorMixin):
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
# Temporary fix for "padding_side" in init_kwargs
|
||||
output_kwargs["text_kwargs"].pop("padding_side", None)
|
||||
|
||||
image_seq_len = image_seq_len if image_seq_len is not None else self.image_seq_len
|
||||
|
||||
n_images_in_text = []
|
||||
|
@ -172,8 +172,6 @@ class LlavaOnevisionProcessor(ProcessorMixin):
|
||||
num_video_tokens = (num_frames * pooled_height_width * pooled_height_width) + 1 # +1 for newline token
|
||||
text = [sample.replace(self.video_token, self.video_token * num_video_tokens) for sample in text]
|
||||
|
||||
# Padding side can be in TextKwargs but is not accepted by the tokenizer
|
||||
_ = output_kwargs["text_kwargs"].pop("padding_side", None)
|
||||
text_inputs = self.tokenizer(text, **output_kwargs["text_kwargs"])
|
||||
return BatchFeature(data={**text_inputs, **image_inputs, **video_inputs})
|
||||
|
||||
|
@ -150,7 +150,6 @@ class Qwen2VLProcessor(ProcessorMixin):
|
||||
index += 1
|
||||
text[i] = text[i].replace("<|placeholder|>", "<|video_pad|>")
|
||||
|
||||
_ = output_kwargs["text_kwargs"].pop("padding_side", None)
|
||||
text_inputs = self.tokenizer(text, **output_kwargs["text_kwargs"])
|
||||
|
||||
return BatchFeature(data={**text_inputs, **image_inputs, **videos_inputs})
|
||||
|
@ -829,7 +829,12 @@ class ProcessorMixin(PushToHubMixin):
|
||||
for modality_key in ModelProcessorKwargs.__annotations__[modality].__annotations__.keys():
|
||||
# init with tokenizer init kwargs if necessary
|
||||
if modality_key in tokenizer_init_kwargs:
|
||||
default_kwargs[modality][modality_key] = tokenizer_init_kwargs[modality_key]
|
||||
value = (
|
||||
getattr(self.tokenizer, modality_key)
|
||||
if hasattr(self.tokenizer, modality_key)
|
||||
else tokenizer_init_kwargs[modality_key]
|
||||
)
|
||||
default_kwargs[modality][modality_key] = value
|
||||
# now defaults kwargs are updated with the tokenizers defaults.
|
||||
# pass defaults to output dictionary
|
||||
output_kwargs.update(default_kwargs)
|
||||
|
Loading…
Reference in New Issue
Block a user