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

Llama2 models not loading (Using main branch) #25388

Closed
4 tasks
dbuos opened this issue Aug 8, 2023 · 6 comments · Fixed by #25407
Closed
4 tasks

Llama2 models not loading (Using main branch) #25388

dbuos opened this issue Aug 8, 2023 · 6 comments · Fixed by #25407

Comments

@dbuos
Copy link
Contributor

dbuos commented Aug 8, 2023

System Info

Error when loading the model "meta-llama/Llama-2-7b-chat-hf" using the following code:

from transformers import AutoModelForCausalLM
chk = 'meta-llama/Llama-2-7b-chat-hf'

if __name__ == '__main__':
    model = AutoModelForCausalLM.from_pretrained(chk, load_in_4bit=True, device_map='auto')
    print("Loaded Ok")

The error message was:

`do_sample` is set to `False`. However, temperature is set to 0.9 -- this flag is only used in sample-based generation modes. Set `do_sample=True` or unset temperature to continue.

This is because the method GenerationConfig.validate() raises a ValueError and that Error is not controlled in modeling_utils.py file.
One possible solution is to add the the ValueError to the except clause in that file:

image

Who can help?

@gante

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction

Using the main branch (install from source code)

from transformers import AutoModelForCausalLM
chk = 'meta-llama/Llama-2-7b-chat-hf'

if __name__ == '__main__':
    model = AutoModelForCausalLM.from_pretrained(chk, load_in_4bit=True, device_map='auto')
    print("Loaded Ok")

Expected behavior

To be able to load the model

@inconnu26
Copy link

I have same issue with another Model. I think this is urgent to fix.

@Hanzofm
Copy link

Hanzofm commented Aug 8, 2023

Same here. Meanwhile downgrading to transfomers 4.31 version solves the problem

@dbuos
Copy link
Contributor Author

dbuos commented Aug 8, 2023

I found this issue in the dev branch of transformers-4.32.0.dev0. By the way, I made a PR that could solve that. #25389

@graeme204
Copy link

Same here!

@gante
Copy link
Member

gante commented Aug 9, 2023

Hey everyone 👋 If you're hitting this exception, it means that there is something wrong with your model's config file 💔

Meanwhile, we are deciding internally how to massage this question into a more user-friendly solution.

@gante
Copy link
Member

gante commented Aug 9, 2023

After the PR above gets merged, you will be able to do everything as before.

The only difference from before is that you will see new warnings, related to poor generate parameterization (which may come from the generation config file, as in the case of llama 2) :)

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