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

[Feature]: Support dense MLP & rope for deepseek architecture #12686

Open
1 task done
wavy-jung opened this issue Feb 3, 2025 · 3 comments
Open
1 task done

[Feature]: Support dense MLP & rope for deepseek architecture #12686

wavy-jung opened this issue Feb 3, 2025 · 3 comments

Comments

@wavy-jung
Copy link

🚀 The feature, motivation and pitch

Huggingface Deepseek-V2 model supports for 1) the case when n_routed_experts is None (which is fully dense model) and 2) the pure RoPE without YaRN.

Alternatives

No response

Additional context

No response

Before submitting a new issue...

  • Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.
@NickLucche
Copy link
Contributor

Would you have the reference of a model employing one of these two architectural changes?

@Isotr0py
Copy link
Collaborator

Isotr0py commented Feb 4, 2025

  1. the pure RoPE without YaRN.

In fact, the pure RoPE without YaRN has been supported in deepseek_v2 and used by deepseek-vl2 models:

if rope_scaling:
rope_scaling["rope_type"] = 'deepseek_yarn'
self.use_normal_rope = False
else:
self.use_normal_rope = True
self.rotary_emb = get_rope(qk_rope_head_dim,
rotary_dim=qk_rope_head_dim,
max_position=max_position_embeddings,
base=rope_theta,
rope_scaling=rope_scaling,
is_neox_style=False)

if self.use_normal_rope:
seq_len = positions.size(0)
ori_q_pe_shape, ori_k_pe_shape = q_pe.shape, k_pe.shape
q_pe = q_pe.reshape(seq_len, -1)
k_pe = k_pe.reshape(seq_len, -1)
q_pe, k_pe = self.rotary_emb(positions, q_pe, k_pe)
if self.use_normal_rope:
q_pe, k_pe = q_pe.view(ori_q_pe_shape), k_pe.view(ori_k_pe_shape)

@Isotr0py
Copy link
Collaborator

Isotr0py commented Feb 4, 2025

FYI, pure RoPE with MLA support will be done in #12729

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants