Skip to content

NotImplementedError: Cannot copy out of meta tensor; no data! #5

@Jimuchen

Description

@Jimuchen

I create a file called 'demo_rec' in 'demo' dictionary to do a demo. But when I execute "bash demo/demo_rec.sh", I meet a NotImplementedError: Cannot copy out of meta tensor; no data! This maybe because a tensor with device("meta") cannot directly converted into a "cuda" tensor.
The content of demo_rec.sh is showed below.

    python demo/demo.py \
    --query "Please describe the location of sandwich in this image." \                                         
    --modality image \
    --data_path demo/examples/rec/COCO_train2014_000000310450.jpg \
    --show \
    --task rec

The whole Traceback is showed below.

  Traceback (most recent call last):
  File "/home/jimu/code/LLaVA-ST/demo/demo.py", line 95, in <module>
    outputs = chat.chat(
  File "/home/jimu/code/LLaVA-ST/demo/demo.py", line 49, in chat
    output_ids = self.model.generate(
  File "/home/jimu/anaconda3/envs/LLaVA-ST/lib/python3.9/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
    return func(*args, **kwargs)
  File "/home/jimu/code/LLaVA-ST/./llava/model/language_model/llava_qwen.py", line 250, in generate
    (inputs, position_ids, attention_mask, _, inputs_embeds, _) = self.prepare_inputs_labels_for_multimodal_video(inputs, position_ids, attention_mask, None, None, images, modalities, image_sizes=image_sizes, variables=variables)
  File "/home/jimu/code/LLaVA-ST/./llava/model/llava_arch.py", line 409, in prepare_inputs_labels_for_multimodal_video
    [self.get_model().embed_tokens.weight, temporal_input_embeddings.to(device), spatial_height_input_embeddings.to(device), spatial_width_input_embeddings.to(device)]
NotImplementedError: Cannot copy out of meta tensor; no data!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions