Open zoryzhang opened 2 months ago
Hi @zoryzhang 👋
We are refactoring several generate
sections, and beam search
is one of the targets -- it's likely that this bug will be squashed in the process. If it is not fixed on main
a month from now, please ping me again 🤗
Hi @gante, still face with the same beam search
problem when using mps
GPU. Could you please check once again was it fixed or not?
Platform: macOS-14.4.1-arm64 (Apple M2 _Pro) Python 3.11.9
transformers version: 4.41.2 huggingface-hub 0.23.4 safetensors 0.4.3 tensorflow 2.16.1 torch 2.2.2
Thank you in advance
System Info
transformers
version: 4.40.1Who can help?
@gante, @ArthurZucker and @younesbelkada
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
Code sample:
When
device = "mps"
it will fail, while it's fine whendevice = "cpu"
.Error message:
My effort: Unsure will this be related.
In "transformers/generation/beam_search.py", I added
print(f"hypo: {hypo}, best_idx: {best_idx}, sent_lengths: {sent_lengths}, sent_max_len: {sent_max_len}") print(f"size hypo: {hypo.size()}, size decoded: {decoded.size()}")
beforedecoded[i, : sent_lengths[i]] = hypo
and a few other prints, and only to seeAll print statements I added:
Expected behavior
There should be no error, and print (as indicated by using device="cpu")
instead of many "3240385333"