convert: fix get block count error for Nemotron 3 Ultra (#27101)
* convert: fix get block count error for Nemotron Signed-off-by: Rock Chen <rockchen.tw@gmail.com> * fix this in NemotronHModel.__init__ instead. This reverts commit ca689cbc8792ba69ea1fd5d8b3ae0485c47536ec. --------- Signed-off-by: Rock Chen <rockchen.tw@gmail.com>
This commit is contained in:
@@ -207,6 +207,8 @@ class NemotronHModel(GraniteHybridModel):
|
|||||||
# calling the parent __init__. This is because the parent constructor
|
# calling the parent __init__. This is because the parent constructor
|
||||||
# uses self.model_arch to build the tensor name map, and all MoE-specific
|
# uses self.model_arch to build the tensor name map, and all MoE-specific
|
||||||
# mappings would be missed if it were called with the default non-MoE arch.
|
# mappings would be missed if it were called with the default non-MoE arch.
|
||||||
|
hparams = kwargs.pop("hparams", None)
|
||||||
|
if hparams is None:
|
||||||
hparams = ModelBase.load_hparams(args[0], self.is_mistral_format)
|
hparams = ModelBase.load_hparams(args[0], self.is_mistral_format)
|
||||||
has_moe_params = (
|
has_moe_params = (
|
||||||
"num_experts_per_tok" in hparams
|
"num_experts_per_tok" in hparams
|
||||||
@@ -215,8 +217,11 @@ class NemotronHModel(GraniteHybridModel):
|
|||||||
if has_moe_params:
|
if has_moe_params:
|
||||||
self.model_arch = gguf.MODEL_ARCH.NEMOTRON_H_MOE
|
self.model_arch = gguf.MODEL_ARCH.NEMOTRON_H_MOE
|
||||||
self.is_moe = True
|
self.is_moe = True
|
||||||
|
layers_block_type = hparams.get("layers_block_type")
|
||||||
|
if layers_block_type is not None:
|
||||||
|
hparams["num_hidden_layers"] = len(layers_block_type)
|
||||||
|
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, hparams=hparams, **kwargs)
|
||||||
|
|
||||||
# Save the top-level head_dim for later
|
# Save the top-level head_dim for later
|
||||||
self.head_dim = self.hparams.get("head_dim", self.hparams.get("attention_head_dim"))
|
self.head_dim = self.hparams.get("head_dim", self.hparams.get("attention_head_dim"))
|
||||||
|
|||||||
Reference in New Issue
Block a user