baize-chatbot icon indicating copy to clipboard operation
baize-chatbot copied to clipboard

Encountering error: app.py has "cannot import name 'LlamaForCausalLM' from 'transformers'"

Open koolkao opened this issue 2 years ago • 6 comments

New to the world of LLMs. I've been playing with the Baize Huggingface demo--it gives great responses!

I'd like to install it on my machine but after a clean install with successful pip install, app.py gives this error: cannot import name 'LlamaForCausalLM' from 'transformers'

Any guidance is appreciated, thank you!

koolkao avatar Apr 04 '23 20:04 koolkao

please update your transformers

guoday avatar Apr 05 '23 01:04 guoday

Thank you! I believe I have successfully installed transformers via this line in requirements.txt: git+https://github.com/huggingface/transformers.git However a search of that Huggingface repository finds no mention of LlamaForCausalLM

Is there somewhere else I should go to update transformers?

thank you

koolkao avatar Apr 05 '23 04:04 koolkao

Simply

pip uninstall transformers
pip install transformers

JetRunner avatar Apr 05 '23 06:04 JetRunner

thank you I appreciate your response. I uninstalled/installed several times to the latest version 4.27.4, and unfortunately still getting the same error

koolkao avatar Apr 05 '23 14:04 koolkao

You can try install from source! Following this page: https://huggingface.co/docs/transformers/installation#installing-from-source or try pip install git+https://github.com/huggingface/transformers.git

JetRunner avatar Apr 05 '23 15:04 JetRunner

However a search of that Huggingface repository finds no mention of LlamaForCausalLM

https://github.com/huggingface/transformers/blob/main/src/transformers/models/llama/modeling_llama.py

JetRunner avatar Apr 05 '23 15:04 JetRunner