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

IndexError when running inference with Llama-2 model #54

Closed
shang-zhu opened this issue Nov 3, 2023 · 3 comments
Closed

IndexError when running inference with Llama-2 model #54

shang-zhu opened this issue Nov 3, 2023 · 3 comments
Assignees

Comments

@shang-zhu
Copy link

shang-zhu commented Nov 3, 2023

Hi thanks for this amazing work.

I followed the installation guide in this issue: #25. but it gives me the following error when running the inference code below on 2 V100 GPUs, each with 32GB:

python src/run_generation.py --model_type llama --model_name_or_path meta-llama/Llama-2-7b-chat-hf \
    --prefix "<s>[INST] <<SYS>>\n You are a helpful assistant. Answer with detailed responses according to the entire instruction or question. \n<</SYS>>\n\n Summarize the following book: " \
    --prompt example_inputs/harry_potter.txt \
    --suffix " [/INST]" --test_unlimiformer --fp16 --length 200 --layer_begin 16 \
    --index_devices 0 --datastore_device 0

Error:

File "/ocean/projects/cts180021p/shang9/foundation_models/openLLM4chem/unlimiformer/src/unlimiformer.py", line 1086, in preprocess_query
    cos = cos[:,:,-1]  # [1, 1, dim]
IndexError: too many indices for tensor of dimension 2

Do you know what may go wrong? Thanks.

@urialon
Copy link
Collaborator

urialon commented Nov 4, 2023

Hi @shang-zhu ,
Thank you for your interest in our work!

What is your pytorch version and transformers version?

Best,
Uri

@shang-zhu
Copy link
Author

Thank you for your quick reply!

Here is my pytorch and transformers version:

torch                     2.1.0                    pypi_0    pypi
transformers              4.36.0.dev0              pypi_0    pypi

@abertsch72 abertsch72 self-assigned this Nov 10, 2023
@shang-zhu
Copy link
Author

I actually made it work with the following software version:

pytorch                   2.0.1           py3.11_cuda11.7_cudnn8.5.0_0    pytorch
transformers              4.31.0                   pypi_0    pypi

Thanks for the help!

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

3 participants