Skip to content

Commit

Permalink
fix test errors
Browse files Browse the repository at this point in the history
  • Loading branch information
leloykun committed Aug 16, 2024
1 parent 45507e0 commit 867baf3
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/transformers/models/clipseg/processing_clipseg.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def __call__(
return encoding
else:
return BatchEncoding(
data=dict(**image_features), tensor_type=output_kwargs["common_kwargs"]["return_tensors"]
data=dict(**image_features), tensor_type=output_kwargs["common_kwargs"].get("return_tensors")
)

def batch_decode(self, *args, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def __call__(
)

# cast to desired return tensors type after concatenating
text_encoding = BatchEncoding(text_encoding, tensor_type=output_kwargs["common_kwargs"]["return_tensors"])
text_encoding = BatchEncoding(text_encoding, tensor_type=output_kwargs["common_kwargs"].get("return_tensors"))
encoding.update(text_encoding)
qformer_text_encoding = self.qformer_tokenizer(text=text, **output_kwargs["text_kwargs"])
encoding["qformer_input_ids"] = qformer_text_encoding.pop("input_ids")
Expand Down
3 changes: 1 addition & 2 deletions src/transformers/models/owlv2/processing_owlv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Owlv2ProcessorKwargs(ProcessingKwargs, total=False):
images_kwargs: Owlv2ImagesKwargs
_defaults = {
"text_kwargs": {
"padding": False,
"padding": "max_length",
},
"common_kwargs": {
"return_tensors": "np",
Expand Down Expand Up @@ -70,7 +70,6 @@ class Owlv2Processor(ProcessorMixin):
def __init__(self, image_processor, tokenizer, **kwargs):
super().__init__(image_processor, tokenizer)

# Copied from transformers.models.owlvit.processing_owlvit.OwlViTProcessor.__call__ with OWLViT->OWLv2
def __call__(
self,
text: Optional[Union[TextInput, PreTokenizedInput, List[TextInput], List[PreTokenizedInput]]] = None,
Expand Down
2 changes: 1 addition & 1 deletion src/transformers/models/owlvit/processing_owlvit.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class OwlViTProcessorKwargs(ProcessingKwargs, total=False):
images_kwargs: OwlViTImagesKwargs
_defaults = {
"text_kwargs": {
"padding": False,
"padding": "max_length",
},
"common_kwargs": {
"return_tensors": "np",
Expand Down

0 comments on commit 867baf3

Please sign in to comment.