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

Zero-shot classification pipeline change in 4.11.2 #13846

Closed
davidmezzetti opened this issue Oct 2, 2021 · 4 comments · Fixed by #13855
Closed

Zero-shot classification pipeline change in 4.11.2 #13846

davidmezzetti opened this issue Oct 2, 2021 · 4 comments · Fixed by #13855

Comments

@davidmezzetti
Copy link
Contributor

The latest version of the ZSL classification pipeline appears to give slightly different output for the following test code:

from transformers import pipeline

nlp = pipeline("zero-shot-classification")
print(nlp(["I am happy", "I am sad"], ["negative", "positive"]))

Version 4.10.2 output

[{'sequence': 'I am happy', 'labels': ['positive', 'negative'], 'scores': [0.9984542727470398, 0.0015457083936780691]}, {'sequence': 'I am sad', 'labels': ['negative', 'positive'], 'scores': [0.9985381364822388, 0.0014618091518059373]}]

Version 4.11.2 output

[[{'sequence': 'I am happy', 'labels': ['positive', 'negative'], 'scores': [0.9984542727470398, 0.0015457083936780691]}], [{'sequence': 'I am sad', 'labels': ['negative', 'positive'], 'scores': [0.9985381364822388, 0.00146180868614465]}]]

It appears that 4.11.2 is adding an extra list around each element. This can be manually processed out but I also wanted to pass this along in case this wasn't expected new behavior.

@lalitpagaria
Copy link
Contributor

@Narsil @LysandreJik fyi
Facing similar issue as well.

@Narsil
Copy link
Contributor

Narsil commented Oct 4, 2021

Thanks for letting us know,

This is unknown breaking backward compatible, fortunately it's an easy fix !

Narsil added a commit to Narsil/transformers that referenced this issue Oct 4, 2021
@lalitpagaria
Copy link
Contributor

@Narsil Thank you for quick fix.
Any idea when this fix will be released?

@Narsil
Copy link
Contributor

Narsil commented Oct 4, 2021

I will let core maintainers answer there but first the PR needs to be reviewed.

lapisfluvialis pushed a commit to lapisfluvialis/transformers that referenced this issue Oct 27, 2021
Albertobegue pushed a commit to Albertobegue/transformers that referenced this issue Jan 27, 2022
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

Successfully merging a pull request may close this issue.

3 participants