From e8e6103f4262751041bf4fcd0d099d065af70ad0 Mon Sep 17 00:00:00 2001 From: Cocoa Date: Sat, 2 Mar 2024 00:20:49 +0800 Subject: [PATCH] add support for starcoder2 --- convert-hf-to-gguf.py | 2 ++ gguf-py/gguf/tensor_mapping.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/convert-hf-to-gguf.py b/convert-hf-to-gguf.py index d3e8ec1f60c70..b05952116c9f2 100755 --- a/convert-hf-to-gguf.py +++ b/convert-hf-to-gguf.py @@ -249,6 +249,8 @@ def _get_model_architecture(self) -> gguf.MODEL_ARCH: return gguf.MODEL_ARCH.FALCON if arch == "GPTBigCodeForCausalLM": return gguf.MODEL_ARCH.STARCODER + if arch == "Starcoder2ForCausalLM": + return gguf.MODEL_ARCH.LLAMA if arch == "GPTRefactForCausalLM": return gguf.MODEL_ARCH.REFACT if arch == "PersimmonForCausalLM": diff --git a/gguf-py/gguf/tensor_mapping.py b/gguf-py/gguf/tensor_mapping.py index 8610037767fb6..db2ec9704a441 100644 --- a/gguf-py/gguf/tensor_mapping.py +++ b/gguf-py/gguf/tensor_mapping.py @@ -210,6 +210,7 @@ class TensorNameMap: "model.layers.layers.{bid}.mlp.up_proj", # plamo "model.layers.{bid}.feed_forward.w3", # internlm2 "encoder.layers.{bid}.mlp.fc11", # nomic-bert + "model.layers.{bid}.mlp.c_fc", # starcoder2 ), MODEL_TENSOR.FFN_UP_EXP: ( @@ -256,6 +257,7 @@ class TensorNameMap: "model.layers.layers.{bid}.mlp.down_proj", # plamo "model.layers.{bid}.feed_forward.w2", # internlm2 "encoder.layers.{bid}.mlp.fc2", # nomic-bert + "model.layers.{bid}.mlp.c_proj", # starcoder2 ), MODEL_TENSOR.FFN_DOWN_EXP: (