Skip to content

Conversation

@Cyrilvallez
Copy link
Member

@Cyrilvallez Cyrilvallez commented Nov 27, 2025

What does this PR do?

As per the title. See here for the source

TODO CYRIL: models modified only apply norm on head_dim!! So should be fine without replication. But then nano_chat needs to remove useless replication, and let's check other models with norms to be sure

cc @vasqu

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@github-actions
Copy link
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: apertus, doge, nanochat

Comment on lines -149 to -153
"layers.*.input_layernorm.weight": "sequence_parallel",
"layers.*.input_residual": "sequence_parallel",
"layers.*.post_attention_layernorm.weight": "sequence_parallel",
"layers.*.post_attention_residual": "sequence_parallel",
"norm.weight": "sequence_parallel",
Copy link
Contributor

Choose a reason for hiding this comment

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

SP is super slow so removed it while I was at it

@vasqu
Copy link
Contributor

vasqu commented Nov 27, 2025

Only a bit weird one is Cohere, it has this use_qk_norm attribute but it defaults to false and the base models also doesn't use it. If it were to use it, we would need to rep, otherwise not. See

if self.use_qk_norm:
# When sharding the model using Tensor Parallelism, need to be careful to use n_local_heads
self.q_norm = CohereLayerNorm(
hidden_size=(config.num_attention_heads, self.head_dim), eps=config.layer_norm_eps
)
self.k_norm = CohereLayerNorm(
hidden_size=(config.num_key_value_heads, self.head_dim), eps=config.layer_norm_eps
)

Not sure if we just rep either way but left it for now

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.

4 participants