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

Optional bias for qwen2 model #32892

Open
wavy-jung opened this issue Aug 20, 2024 · 2 comments · May be fixed by #32893
Open

Optional bias for qwen2 model #32892

wavy-jung opened this issue Aug 20, 2024 · 2 comments · May be fixed by #32893
Labels
Feature request Request for a new feature

Comments

@wavy-jung
Copy link
Contributor

Feature request

bias of linear layers in qwen2 model is hard coded as following:

  • self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
    self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
    self.down_proj = nn.Linear(self.intermediate_size, self.hidden_size, bias=False)
  • self.q_proj = nn.Linear(self.hidden_size, self.num_heads * self.head_dim, bias=True)
    self.k_proj = nn.Linear(self.hidden_size, self.num_key_value_heads * self.head_dim, bias=True)
    self.v_proj = nn.Linear(self.hidden_size, self.num_key_value_heads * self.head_dim, bias=True)
    self.o_proj = nn.Linear(self.num_heads * self.head_dim, self.hidden_size, bias=False)

It would be good to make bias optionally configurable through a config file to ensure compatibility with the latest models. (e.g. llama)

Motivation

bias is optional in llama model as following:

  • self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=config.mlp_bias)
    self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=config.mlp_bias)
    self.down_proj = nn.Linear(self.intermediate_size, self.hidden_size, bias=config.mlp_bias)

Your contribution

I'll submit PR for this feature

@wavy-jung wavy-jung added the Feature request Request for a new feature label Aug 20, 2024
@wavy-jung wavy-jung linked a pull request Aug 20, 2024 that will close this issue
5 tasks
@amyeroberts
Copy link
Collaborator

cc @ArthurZucker

@ArthurZucker
Copy link
Collaborator

Answered on the PR~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature request Request for a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants