fix(convert): Sanity check on merged FFN tensor sizes
Branch: GraniteMoE Co-Authored-By: git@compilade.net Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
This commit is contained in:
parent
f2360996ca
commit
317b15bb60
1 changed files with 3 additions and 1 deletions
|
@ -4127,7 +4127,9 @@ class GraniteMoeModel(GraniteModel):
|
|||
"""
|
||||
|
||||
if name.endswith("block_sparse_moe.input_linear.weight"):
|
||||
gate, up = data_torch.chunk(2, dim=-2)
|
||||
ffn_dim = self.hparams["intermediate_size"]
|
||||
assert data_torch.shape[-2] == 2 * ffn_dim, "Merged FFN tensor size must be 2 * intermediate_size"
|
||||
gate, up = data_torch[..., :ffn_dim, :], data_torch[..., ffn_dim:, :]
|
||||
return [
|
||||
(self.format_tensor_name(gguf.MODEL_TENSOR.FFN_GATE_EXP, bid), gate),
|
||||
(self.format_tensor_name(gguf.MODEL_TENSOR.FFN_UP_EXP, bid), up),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue