diff --git a/convert_hf_to_gguf.py b/convert_hf_to_gguf.py index 43e61b500315e..bb15707ff6a70 100755 --- a/convert_hf_to_gguf.py +++ b/convert_hf_to_gguf.py @@ -3859,9 +3859,9 @@ def set_gguf_parameters(self): self.gguf_writer.add_expert_weights_norm(hparams["norm_topk_prob"]) if hparams["scoring_func"] == "sigmoid": - self.gguf_writer.add_expert_weights_func(gguf.ExpertWeightsFuncType.SIGMOID) + self.gguf_writer.add_expert_gating_func(gguf.ExpertGatingFuncType.SIGMOID) elif hparams["scoring_func"] == "softmax": - self.gguf_writer.add_expert_weights_func(gguf.ExpertWeightsFuncType.SOFTMAX) + self.gguf_writer.add_expert_gating_func(gguf.ExpertGatingFuncType.SOFTMAX) else: raise ValueError(f"Unsupported scoring_func value: {hparams['scoring_func']}") diff --git a/gguf-py/gguf/constants.py b/gguf-py/gguf/constants.py index 13b77979b1718..1302000ee95d0 100644 --- a/gguf-py/gguf/constants.py +++ b/gguf-py/gguf/constants.py @@ -103,7 +103,7 @@ class LLM: EXPERT_SHARED_COUNT = "{arch}.expert_shared_count" EXPERT_WEIGHTS_SCALE = "{arch}.expert_weights_scale" EXPERT_WEIGHTS_NORM = "{arch}.expert_weights_norm" - EXPERT_WEIGHTS_FUNC = "{arch}.expert_weights_func" + EXPERT_GATING_FUNC = "{arch}.expert_gating_func" POOLING_TYPE = "{arch}.pooling_type" LOGIT_SCALE = "{arch}.logit_scale" DECODER_START_TOKEN_ID = "{arch}.decoder_start_token_id" @@ -1581,7 +1581,7 @@ class GGMLQuantizationType(IntEnum): TQ2_0 = 35 -class ExpertWeightsFuncType(IntEnum): +class ExpertGatingFuncType(IntEnum): SOFTMAX = 1 SIGMOID = 2 diff --git a/gguf-py/gguf/gguf_writer.py b/gguf-py/gguf/gguf_writer.py index a0dadeaf8183a..4a0a65e3cc33e 100644 --- a/gguf-py/gguf/gguf_writer.py +++ b/gguf-py/gguf/gguf_writer.py @@ -26,7 +26,7 @@ RopeScalingType, PoolingType, TokenType, - ExpertWeightsFuncType, + ExpertGatingFuncType, ) from .quants import quant_shape_from_byte_shape @@ -719,8 +719,8 @@ def add_expert_weights_scale(self, value: float) -> None: def add_expert_weights_norm(self, value: bool) -> None: self.add_bool(Keys.LLM.EXPERT_WEIGHTS_NORM.format(arch=self.arch), value) - def add_expert_weights_func(self, value: ExpertWeightsFuncType) -> None: - self.add_uint32(Keys.LLM.EXPERT_WEIGHTS_FUNC.format(arch=self.arch), value.value) + def add_expert_gating_func(self, value: ExpertGatingFuncType) -> None: + self.add_uint32(Keys.LLM.EXPERT_GATING_FUNC.format(arch=self.arch), value.value) def add_swin_norm(self, value: bool) -> None: self.add_bool(Keys.LLM.SWIN_NORM.format(arch=self.arch), value)