Skip to content

Commit 1a0485d

Browse files
committed
fix self.block_count for vision
1 parent e5c5fd7 commit 1a0485d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

convert_hf_to_gguf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ def __init__(self, *args, **kwargs):
460460
# move the text_config to the root level
461461
self.hparams = {**self.hparams, **self.hparams["text_config"]}
462462

463-
self.block_count = self.find_hparam(["n_layers", "num_hidden_layers", "n_layer", "num_layers", "depth"])
463+
self.block_count = self.find_hparam(["n_layers", "num_hidden_layers", "n_layer", "num_layers"])
464464
self.tensor_map = gguf.get_tensor_name_map(self.model_arch, self.block_count)
465465

466466
@classmethod
@@ -1097,7 +1097,7 @@ def __init__(self, *args, **kwargs):
10971097
self.global_config = self.hparams
10981098
self.hparams = self.hparams["vision_config"]
10991099

1100-
self.block_count = self.find_hparam(["n_layers", "num_hidden_layers", "n_layer", "num_layers"])
1100+
self.block_count = self.find_hparam(["n_layers", "num_hidden_layers", "n_layer", "num_layers", "depth"])
11011101
self.tensor_map = gguf.get_tensor_name_map(gguf.MODEL_ARCH.CLIP_VISION, self.block_count)
11021102

11031103
# load preprocessor config
@@ -1117,7 +1117,7 @@ def set_gguf_parameters(self):
11171117
self.gguf_writer.add_vision_patch_size(self.find_hparam(["patch_size"]))
11181118
self.gguf_writer.add_vision_embedding_length(self.find_hparam(["hidden_size"]))
11191119
self.gguf_writer.add_vision_feed_forward_length(self.find_hparam(["intermediate_size"]))
1120-
self.gguf_writer.add_vision_block_count(self.find_hparam(["num_hidden_layers"]))
1120+
self.gguf_writer.add_vision_block_count(self.block_count)
11211121
self.gguf_writer.add_vision_head_count(self.find_hparam(["num_attention_heads"]))
11221122

11231123
# preprocessor config

0 commit comments

Comments
 (0)