Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions python/mlc_llm/model/gemma/gemma_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class GemmaConfig(ConfigBase): # pylint: disable=too-many-instance-attributes
"""Configuration of the Gemma model."""

hidden_size: int
hidden_act: str
hidden_activation: Optional[str]
intermediate_size: int
attention_bias: bool
num_attention_heads: int
Expand All @@ -39,7 +39,9 @@ class GemmaConfig(ConfigBase): # pylint: disable=too-many-instance-attributes
kwargs: Dict[str, Any] = dataclasses.field(default_factory=dict)

def __post_init__(self):
if self.hidden_act not in ("gelu", "gelu_pytorch_tanh"):
if self.hidden_activation is None:
self.hidden_activation = self.kwargs.get("hidden_act", None)
if self.hidden_activation not in ("gelu", "gelu_pytorch_tanh"):
raise ValueError("Only GeLU is supported as the activation for gemma.")
if self.attention_bias:
raise ValueError('Only "False" attention_bias is supported for gemma')
Expand Down