moondream icon indicating copy to clipboard operation
moondream copied to clipboard

Running transformers is stuck at a point

Open abhishekmg opened this issue 8 months ago • 2 comments

I am trying to run the code in the example

from transformers import AutoModelForCausalLM, AutoTokenizer
from PIL import Image

model_id = "vikhyatk/moondream2"
revision = "2024-05-20"
model = AutoModelForCausalLM.from_pretrained(
    model_id, trust_remote_code=True, revision=revision
)
tokenizer = AutoTokenizer.from_pretrained(model_id, revision=revision)

image = Image.open('<IMAGE_PATH>')
enc_image = model.encode_image(image)
print(model.answer_question(enc_image, "Describe this image.", tokenizer))

But for some reason at the model.answer_question(enc_image, "Describe this image.", tokenizer) the program is stuck and when I KeyboardInterrupt it I get this as the trace

image

Any help is much appreciated, thanks

abhishekmg avatar Jun 26 '24 14:06 abhishekmg