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

ImportError: cannot import name 'LlavaLlamaForCausalLM' from 'llava.model' (/root/LLaVA/llava/model/__init__.py) #1840

Open
intelligence66 opened this issue Feb 26, 2025 · 5 comments

Comments

@intelligence66
Copy link

Question

I encountered an issue where I was unable to import the model while running Lora fine-tuning again,this is the printed log:
Traceback (most recent call last):
File "/root/LLaVA/llava/train/train_mem.py", line 1, in
from llava.train.train import train
File "/root/LLaVA/llava/init.py", line 1, in
from .model import LlavaLlamaForCausalLM
ImportError: cannot import name 'LlavaLlamaForCausalLM' from 'llava.model' (/root/LLaVA/llava/model/init.py)

The script I am running is: sh ./scripts/v1_5/finetune_task_lora.sh

@SixCorePeach
Copy link

I also encount for this problem, is there lack of any file named the LlavaLlamaForCausalLM ?

@SixCorePeach
Copy link

SixCorePeach commented Feb 27, 2025

oh, I see the init file,
AVAILABLE_MODELS = {
"llava_llama": "LlavaLlamaForCausalLM, LlavaConfig",
"llava_qwen": "LlavaQwenForCausalLM, LlavaQwenConfig",
"llava_mistral": "LlavaMistralForCausalLM, LlavaMistralConfig",
"llava_mixtral": "LlavaMixtralForCausalLM, LlavaMixtralConfig",
# "llava_qwen_moe": "LlavaQwenMoeForCausalLM, LlavaQwenMoeConfig",
# Add other models as needed
}
we could try to initial the corresponding model.
e.g. the llava_llama is in llava.model.language_model

when you solve this problem, there will get another one

@intelligence66
Copy link
Author

There was a version conflict with the package, but I resolved it after reinstalling the package version.This is the version of the package I reinstalled:

Image

@rajsinha02
Copy link

I am facing this exact same issue. Was anyone able to resolve successfully?

@liuxiang09
Copy link

这是 flash-attn 包与 PyTorch 版本不兼容导致的问题。首先pytorch版本要是12.1,然后如果你只是想先试一下demo,可以通过pip uninstall flash-attn ,卸载flash-attn。在其他条件正常的情况下,就不会出现这个报错了

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

4 participants