Skip to content

Chapter #9- Running issue #44

@armin55fp

Description

@armin55fp

Hi,

When I am running the following part in the colab:

# Generate image ids to be passed to the decoder (LLM)
generated_ids = model.generate(**inputs, max_new_tokens=20)

# Generate text from the image ids
generated_text = blip_processor.batch_decode(generated_ids, skip_special_tokens=True)
generated_text = generated_text[0].strip()
generated_text

I am getting this error:

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
[<ipython-input-25-4e509c2e1006>](https://localhost:8080/#) in <cell line: 0>()
      1 # Generate image ids to be passed to the decoder (LLM)
----> 2 generated_ids = model.generate(**inputs, max_new_tokens=20)
      3 
      4 # Generate text from the image ids
      5 generated_text = blip_processor.batch_decode(generated_ids, skip_special_tokens=True)

8 frames
[/usr/local/lib/python3.11/dist-packages/torch/nn/functional.py](https://localhost:8080/#) in layer_norm(input, normalized_shape, weight, bias, eps)
   2908             eps=eps,
   2909         )
-> 2910     return torch.layer_norm(
   2911         input, normalized_shape, weight, bias, eps, torch.backends.cudnn.enabled
   2912     )

RuntimeError: expected scalar type Float but found Half

Can you please explain?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions