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

Errors with Attention Mechanisms in Janus Inference Script (FlashAttention 2.0 & _flash_supports_window_size) #29

Open
AlanPonnachan opened this issue Dec 21, 2024 · 0 comments

Comments

@AlanPonnachan
Copy link

I encountered multiple issues when running the Janus-1.3B model inference script, both with and without enabling FlashAttention. These errors prevent successful execution of the model in a standard environment, such as Google Colab. Below are the details of the issues:

Problem 1: Error Without FlashAttention

When running the inference script without FlashAttention, the following error is raised during the generate function call:
NameError: name '_flash_supports_window_size' is not defined

Problem 2: FlashAttention 2.0 Unsupported

To address the above error, I attempted to install FlashAttention-2 and enable it via the attn_implementation="flash_attention_2" argument. However, this raises the following error:
ValueError: MultiModalityCausalLM does not support Flash Attention 2.0 yet. Please request to add support where the model is hosted, on its model hub page: https://huggingface.co/deepseek-ai/Janus-1.3B/discussions/new

Steps to Reproduce:

  1. Install FlashAttention 2.0 via:
    pip install flash-attn --no-build-isolation
    2.Modify the script to include:
vl_gpt: MultiModalityCausalLM = AutoModelForCausalLM.from_pretrained(
    model_path, trust_remote_code=True, attn_implementation="flash_attention_2"
)

Thank you for your assistance! Let me know if you require additional details or logs to reproduce the issues.

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

1 participant