Error occured after "Update for `transformers` (#5)". (shape mismatch: value tensor of shape [393216] cannot be broadcast to indexing result of shape [0])
#6
by
newjacob19
- opened
Hi.
All of a sudden, this error occurred. It was fine when I used this model about 5 days ago.
The error was shape mismatch: value tensor of shape [393216] cannot be broadcast to indexing result of shape [0].
I was trying to figure out why this happened, although my code was not changed...
But I finally figure out this is because of the Update for transformers
(#5)
Here is the error.
What should I do?
RuntimeError
shape mismatch: value tensor of shape [393216] cannot be broadcast to indexing result of shape [0]
File "/ssd01/jisu_sohee/PAVLM/jacob/transformers/models/blip_2/modeling_blip_2.py", line 2324, in generate
inputs_embeds[special_image_mask] = language_model_inputs.flatten()
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
File "/ssd01/jisu_sohee/PAVLM/jacob/ad_setting10.py", line 515, in forward
captionA_outputs = self.blip2_model.generate(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ssd01/jisu_sohee/PAVLM/jacob/trainer_setting10.py", line 171, in validate_per_epoch
loss,acc = self.model(
^^^^^^^^^^^
File "/ssd01/jisu_sohee/PAVLM/jacob/trainer_setting10.py", line 199, in train
_ = self.validate_per_epoch(-1, initial_infernece=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ssd01/jisu_sohee/PAVLM/jacob/trainer_setting10.py", line 239, in <module>
trainer.train(ckpt_dir="checkpoints/mvtec_setting10")
RuntimeError: shape mismatch: value tensor of shape [393216] cannot be broadcast to indexing result of shape [0]
Same issues! How to solve such problems ? Could you give me some suggestions ? Thank you ~~~~~
Hi,
You're probably encountering the same issue as https://huggingface.co/Salesforce/blip2-opt-2.7b/discussions/39
Same issues! How to solve such problems ? Could you give me some suggestions ? Thank you ~~~~~
I use the previous version, blip2.