Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'NoneType' object has no attribute 'shape' #117

Open
Ringhu opened this issue Mar 11, 2024 · 1 comment
Open

AttributeError: 'NoneType' object has no attribute 'shape' #117

Ringhu opened this issue Mar 11, 2024 · 1 comment

Comments

@Ringhu
Copy link

Ringhu commented Mar 11, 2024

Hi, thank you for your excellent work. I trained my own lisa model and merged the weights. But when i try to run the chat.py for inference, the error occured after input the prompt and image path:

Traceback (most recent call last):
  File "/cluster/home/hulining/proj/LISA/chat.py", line 263, in <module>
    main(sys.argv[1:])
  File "/cluster/home/hulining/proj/LISA/chat.py", line 221, in main
    output_ids, pred_masks = model.evaluate(
  File "/cluster/home/hulining/proj/LISA/model/LISA.py", line 354, in evaluate
    outputs = self.generate(
  File "/cluster/home/hulining/anaconda3/envs/lisa/lib/python3.10/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "/cluster/home/hulining/anaconda3/envs/lisa/lib/python3.10/site-packages/transformers/generation/utils.py", line 1606, in generate
    return self.greedy_search(
  File "/cluster/home/hulining/anaconda3/envs/lisa/lib/python3.10/site-packages/transformers/generation/utils.py", line 2454, in greedy_search
    outputs = self(
  File "/cluster/home/hulining/anaconda3/envs/lisa/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "/cluster/home/hulining/proj/LISA/model/LISA.py", line 166, in forward
    return super().forward(**kwargs)
  File "/cluster/home/hulining/proj/LISA/model/llava/model/language_model/llava_llama.py", line 88, in forward
    ) = self.prepare_inputs_labels_for_multimodal(
  File "/cluster/home/hulining/proj/LISA/model/llava/model/llava_arch.py", line 110, in prepare_inputs_labels_for_multimodal
    (attention_mask.shape[0], past_key_values[-1][-1].shape[-2] + 1),
AttributeError: 'NoneType' object has no attribute 'shape'

i traced the error and found the solution, which is change the past_key_values to None in code llava_llama.py line 132, but i don't know why it happen, can you help me? Thank you.

@dreamingaa
Copy link

@Ringhu i met the same issue. did you fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants