mlfoundations / open_clip

An open source implementation of CLIP.
Other
9.14k stars 908 forks source link

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

Closed wujohns closed 2 weeks ago

wujohns commented 3 months ago

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 commented 3 months ago

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

ialhashim commented 3 months ago

@Aristotelis1 suggestion's works generation_type=

colton138 commented 3 months ago

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

OrderJade commented 3 months ago

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 commented 3 months ago

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 commented 2 months ago

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

colton138 commented 2 months ago

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

Thank you!

eware-godaddy commented 2 months ago

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