Unverified Commit 2b30afa4 authored by nopperl's avatar nopperl Committed by GitHub
Browse files

Use hidden_size_per_head as head_size fallback (#24221)


Signed-off-by: default avatarnopperl <54780682+nopperl@users.noreply.github.com>
parent eafa8dcd
...@@ -1426,6 +1426,11 @@ class ModelConfig: ...@@ -1426,6 +1426,11 @@ class ModelConfig:
if getattr(self.hf_text_config, "head_dim", None) is not None: if getattr(self.hf_text_config, "head_dim", None) is not None:
return self.hf_text_config.head_dim return self.hf_text_config.head_dim
# NOTE: Some models (such as PLaMo2.1) use `hidden_size_per_head`
if getattr(self.hf_text_config, "hidden_size_per_head",
None) is not None:
return self.hf_text_config.hidden_size_per_head
# FIXME(woosuk): This may not be true for all models. # FIXME(woosuk): This may not be true for all models.
return (self.hf_text_config.hidden_size // return (self.hf_text_config.hidden_size //
self.hf_text_config.num_attention_heads) self.hf_text_config.num_attention_heads)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment