Skip to content
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

Truncation does not happen with CLIP models. #3210

Open
GChrysostomou opened this issue Feb 3, 2025 · 0 comments
Open

Truncation does not happen with CLIP models. #3210

GChrysostomou opened this issue Feb 3, 2025 · 0 comments

Comments

@GChrysostomou
Copy link

GChrysostomou commented Feb 3, 2025

Was trying out CLIP via sentence-transformers however I have an error following tokenization that the input has not been truncated. Not sure if this is down to the transformer's version so attaching all information below.

Error:

RuntimeError: The size of tensor a (129) must match the size of tensor b (77) at non-singleton dimension 1

Packages:

sentence-transformers = 3.4.0
transformers = 4.48.1

This refers to this line ->

encoding = self.processor.tokenizer(texts_values, return_tensors="pt", padding=padding)

where to work I needed to add:

..padding, truncation = True)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant