mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2025-11-19 11:57:07 +00:00
convert : use all parts in safetensors index (#17286)
This commit is contained in:
@@ -189,10 +189,10 @@ class ModelBase:
|
|||||||
return tensors
|
return tensors
|
||||||
|
|
||||||
prefix = "model" if not self.is_mistral_format else "consolidated"
|
prefix = "model" if not self.is_mistral_format else "consolidated"
|
||||||
part_names: list[str] = ModelBase.get_model_part_names(self.dir_model, prefix, ".safetensors")
|
part_names: set[str] = set(ModelBase.get_model_part_names(self.dir_model, prefix, ".safetensors"))
|
||||||
is_safetensors: bool = len(part_names) > 0
|
is_safetensors: bool = len(part_names) > 0
|
||||||
if not is_safetensors:
|
if not is_safetensors:
|
||||||
part_names = ModelBase.get_model_part_names(self.dir_model, "pytorch_model", ".bin")
|
part_names = set(ModelBase.get_model_part_names(self.dir_model, "pytorch_model", ".bin"))
|
||||||
|
|
||||||
tensor_names_from_index: set[str] = set()
|
tensor_names_from_index: set[str] = set()
|
||||||
|
|
||||||
@@ -209,6 +209,7 @@ class ModelBase:
|
|||||||
if weight_map is None or not isinstance(weight_map, dict):
|
if weight_map is None or not isinstance(weight_map, dict):
|
||||||
raise ValueError(f"Can't load 'weight_map' from {index_name!r}")
|
raise ValueError(f"Can't load 'weight_map' from {index_name!r}")
|
||||||
tensor_names_from_index.update(weight_map.keys())
|
tensor_names_from_index.update(weight_map.keys())
|
||||||
|
part_names |= set(weight_map.values())
|
||||||
else:
|
else:
|
||||||
weight_map = {}
|
weight_map = {}
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user