Remove unused config field from Gemma2 (#36672)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
@@ -63,7 +63,6 @@ class Gemma2MLP(nn.Module):
|
|||||||
self,
|
self,
|
||||||
hidden_size: int,
|
hidden_size: int,
|
||||||
intermediate_size: int,
|
intermediate_size: int,
|
||||||
hidden_act: str,
|
|
||||||
hidden_activation: str,
|
hidden_activation: str,
|
||||||
quant_config: QuantizationConfig | None = None,
|
quant_config: QuantizationConfig | None = None,
|
||||||
prefix: str = "",
|
prefix: str = "",
|
||||||
@@ -83,11 +82,10 @@ class Gemma2MLP(nn.Module):
|
|||||||
quant_config=quant_config,
|
quant_config=quant_config,
|
||||||
prefix=f"{prefix}.down_proj",
|
prefix=f"{prefix}.down_proj",
|
||||||
)
|
)
|
||||||
if not (hidden_act == hidden_activation == "gelu_pytorch_tanh"):
|
if not (hidden_activation == "gelu_pytorch_tanh"):
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"Gemma2 uses `gelu_pytorch_tanh` as the hidden activation "
|
"Gemma2 uses `gelu_pytorch_tanh` as the hidden activation "
|
||||||
"function. Please set `hidden_act` and `hidden_activation` to "
|
"function. Please set `hidden_activation` to `gelu_pytorch_tanh`."
|
||||||
"`gelu_pytorch_tanh`."
|
|
||||||
)
|
)
|
||||||
self.act_fn = GeluAndMul(approximate="tanh")
|
self.act_fn = GeluAndMul(approximate="tanh")
|
||||||
|
|
||||||
@@ -212,7 +210,6 @@ class Gemma2DecoderLayer(nn.Module):
|
|||||||
self.mlp = Gemma2MLP(
|
self.mlp = Gemma2MLP(
|
||||||
hidden_size=self.hidden_size,
|
hidden_size=self.hidden_size,
|
||||||
intermediate_size=config.intermediate_size,
|
intermediate_size=config.intermediate_size,
|
||||||
hidden_act=config.hidden_act,
|
|
||||||
hidden_activation=config.hidden_activation,
|
hidden_activation=config.hidden_activation,
|
||||||
quant_config=quant_config,
|
quant_config=quant_config,
|
||||||
prefix=f"{prefix}.mlp",
|
prefix=f"{prefix}.mlp",
|
||||||
|
|||||||
Reference in New Issue
Block a user