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

RuntimeError: Boolean value of Tensor with more than one value is ambiguous #847

Open
wujohns opened this issue Mar 27, 2024 · 8 comments · May be fixed by #860
Open

RuntimeError: Boolean value of Tensor with more than one value is ambiguous #847

wujohns opened this issue Mar 27, 2024 · 8 comments · May be fixed by #860

Comments

@wujohns
Copy link

wujohns commented Mar 27, 2024

The coca model demo not work and the wrong code is here:

# open_clip/coca_model.py 
...
if beam_scorer.is_done or stopping_criteria(input_ids, None):
  break
...

the beam_scorer.is_done is like: ensor(False, device='cuda:0')
the stopping_criteria(input_ids, None) is like: tensor([False, False, False, False, False, False], device='cuda:0')

the beam_scorer.is_done or stopping_criteria(input_ids, None) is like tensor([False, False, False, False, False, False], device='cuda:0')
but when you run if tensor([False, False, False, False, False, False], device='cuda:0') it will case RuntimeError: Boolean value of Tensor with more than one value is ambiguous

@Aristotelis1
Copy link

I had the same issue and I tried a different generation_type to be able to generate captions for now

@ialhashim
Copy link

ialhashim commented Apr 3, 2024

@Aristotelis1 suggestion's works generation_type=

@colton138
Copy link

Hi, has there been a fix that includes beam_search?
having the same issue but as mentioned, changing generation_type does work.

@OrderJade
Copy link

I had the same issue and I tried a different generation_type to be able to generate captions for now

bro,what exactly is your operational process?

@colton138
Copy link

I had the same issue and I tried a different generation_type to be able to generate captions for now

bro,what exactly is your operational process?

The Coca model demo in the repo that's in a colab

@MengqingCao MengqingCao linked a pull request Apr 12, 2024 that will close this issue
@MengqingCao
Copy link

MengqingCao commented Apr 12, 2024

There is a solution in #860, hope it helps. : )

@colton138
Copy link

There is a resolution in #860, hope it helps. : )

Thank you!

@eware-godaddy
Copy link

If you can't wait for #860 to be merged, you can roll back to the transformers==4.38.2 which is the last version before the change.

This is the commit that broke this, and it was introduced in 4.39.0

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.

7 participants