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

Training LLaVA with the Liger kernel results in degraded performance. #319

Open
y-rok opened this issue Oct 22, 2024 · 2 comments
Open

Training LLaVA with the Liger kernel results in degraded performance. #319

y-rok opened this issue Oct 22, 2024 · 2 comments

Comments

@y-rok
Copy link

y-rok commented Oct 22, 2024

🐛 Describe the bug

I attempted to train LLaVA (base LLM = LLaMA 3) using the Liger kernel. The loss graph was similar to when I trained LLaVA without the Liger kernel. However, the model trained with the Liger kernel showed lower performance on MLLM benchmarks, such as ChartQA. Since I used LLaMA 3, which is supported by Liger, I didn't expect any issues. Has anyone else tried training LLaVA with the Liger kernel?

Reproduce

from liger_kernel.transformers import apply_liger_kernel_to_llama
print("Apply liger_kernel_to_llama")
apply_liger_kernel_to_llama()

model = LlavaLlamaForCausalLM.from_pretrained(
                "meta-llama/Meta-Llama-3-8B",
                attn_implementation="flash_attention_2",
                torch_dtype=(torch.bfloat16),
            )

Versions

transformer = 4.45.1
torch = 2.4.0
a100

@hhaAndroid
Copy link

hhaAndroid commented Oct 25, 2024

I used xtuner to train llava, and there was no decrease in performance. I find this feature very useful and highly recommend it!

image

The training time remains almost unchanged, and the GPU memory usage is reduced by about 20%. If the sequence length is increased or a smaller model is used, the memory usage can be reduced by up to 50%.

@y-rok
Copy link
Author

y-rok commented Nov 15, 2024

Could you share a code snippet showing how to apply the Liger Kernel for training a model with xtuner?

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