mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2026-09-11 07:19:03 +02:00
convert: fix get block count error for Nemotron
Signed-off-by: Rock Chen <rockchen.tw@gmail.com>
This commit is contained in:
+3
-1
@@ -1126,6 +1126,8 @@ class ModelBase:
|
||||
except KeyError:
|
||||
raise NotImplementedError(f'Architecture {arch!r} not supported!') from None
|
||||
|
||||
def get_block_count(self) -> Any:
|
||||
return self.find_hparam(["n_layers", "num_hidden_layers", "n_layer", "num_layers"])
|
||||
|
||||
class TextModel(ModelBase):
|
||||
model_type = ModelType.TEXT
|
||||
@@ -1142,7 +1144,7 @@ class TextModel(ModelBase):
|
||||
# move the text_config to the root level
|
||||
self.hparams = {**self.hparams, **self.hparams["text_config"]}
|
||||
|
||||
self.block_count = self.find_hparam(["n_layers", "num_hidden_layers", "n_layer", "num_layers"])
|
||||
self.block_count = self.get_block_count()
|
||||
self.tensor_map = gguf.get_tensor_name_map(self.model_arch, self.block_count)
|
||||
|
||||
self.rope_parameters = self.hparams.get("rope_parameters", self.hparams.get("rope_scaling")) or {}
|
||||
|
||||
@@ -497,3 +497,11 @@ class NemotronHModel(GraniteHybridModel):
|
||||
experts = [k for d in self._experts for k in d.keys()]
|
||||
if len(experts) > 0:
|
||||
raise ValueError(f"Unprocessed experts: {experts}")
|
||||
|
||||
def get_block_count(self) -> Any:
|
||||
types = self.find_hparam(["layers_block_type"], True)
|
||||
|
||||
if types is not None:
|
||||
return len(types)
|
||||
|
||||
return super().get_block_count()
|
||||
|
||||
Reference in New Issue
Block a user