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

Why head_size must be 576 while q_head_dim of DeepSeek-V3 is only 192? #49

Open
WangNorthSea opened this issue Feb 27, 2025 · 1 comment

Comments

@WangNorthSea
Copy link

Image

head_size here comes from q.sizes()[3]
But in 'modeling_deepseek.py' of DeepSeek-V3 model,
q = q.view(bsz, q_len, self.num_heads, self.q_head_dim).transpose(1, 2)
Here self.q_head_dim = config.qk_nope_head_dim + config.qk_rope_head_dim which is 128+64=192 according to 'config.json'.
How to understand this correctly?

@Kevinstone-199898
Copy link

The head size is qk_rope_head_dim+kv_lora_rank = 64+512 = 576, which is same in deepseek v2, v3 and r1. This is the absorbed version instead of the ordinary huggingface version

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