fix AttributeError: 'MixtralLayer' object has no attribute 'mlp' (#2123)

https://github.com/huggingface/text-generation-inference/issues/2122
This commit is contained in:
icyboy™ 2024-07-01 20:17:22 +08:00 committed by GitHub
parent 2ce8019480
commit 9d0ca503a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -153,7 +153,7 @@ class BaseFlashMistral(FlashCausalLM):
# TODO: this is a hack to avoid the gate_proj for
# FlashStarcoder2 that doesnt have these layers
if hasattr(layer.mlp, "gate_up_proj"):
if hasattr(layer, "mlp") and hasattr(layer.mlp, "gate_up_proj"):
layer_weights[(i, "gate_proj")] = (
f"{prefix}.{i}.mlp.gate_proj",
layer.mlp.gate_up_proj,