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

Make qwen2 attention_qkv_bias optional #32893

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wavy-jung
Copy link
Contributor

What does this PR do?

Qwen2 and Qwen2-MoE model is forced to add bias to the query, key and value linear projections.
However, following the trend with other recent models (e.g. llama), I refactored these attention_qkv_bias to be optional so that we can configure it in config file.

Fixes #32892

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

@ArthurZucker @stevhliu

- compatibility w/ llama model
@wavy-jung
Copy link
Contributor Author

RuntimeError: Failed to import transformers.models.audio_spectrogram_transformer.feature_extraction_audio_spectrogram_transformer because of the following error (look up to see its traceback):

I have no idea why the check_repo test failed with the error messages above. Can you please give me some guides?
to: @ArthurZucker @stevhliu

@amyeroberts
Copy link
Collaborator

cc @ArthurZucker

Copy link
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! We usually do this when there is actually a model that is published and has this config option set / unset.
attention_bias for llama for example

@wavy-jung
Copy link
Contributor Author

@ArthurZucker Thank you for your response!
What I intended is to allow the option to be set/unset in qwen2 as well. In fact, the LLaMA model has never used a bias in linear projection across all its series, and in the official repository, they are all set to bias=False. However, in the Hugging Face implementation, this can be set/unset through the config. Therefore, I want to provide the same functionality here as well.

@wavy-jung
Copy link
Contributor Author

@ArthurZucker Hey, do you have any further comments for this?

@ArthurZucker
Copy link
Collaborator

Hey! The reason we added that param for llama is for the release of #26302: InternLM was officially using this flag, meaning there is a model related to this change!
Unless a model is publish we usually avoid just enabling something that does not have a model associated! 🤗

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

Successfully merging this pull request may close these issues.

Optional bias for qwen2 model
3 participants