Skip to content

Commit e28771a

Browse files
CISCrsenthilkumar6
authored andcommitted
convert : filter lora tensor names (ggml-org#23077)
1 parent a8d1ed1 commit e28771a

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

convert_lora_to_gguf.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,11 @@ def get_tensors(self) -> Iterator[tuple[str, Tensor]]:
445445
if self.lazy:
446446
tensor = LazyTorchTensor.from_eager(tensor)
447447
base_name = get_base_tensor_name(name)
448+
# filter base name, ignore tensor transformations for now
449+
data_gen = lambda g=tensor: g # noqa: E731
450+
if (titem := self.filter_tensors((base_name, data_gen))) is None:
451+
continue
452+
base_name, _ = titem
448453
# note: mergekit-extract-lora also adds token embeddings to the adapter
449454
is_lora_a = ".lora_A.weight" in name or ".lora_embedding_A" in name
450455
is_lora_b = ".lora_B.weight" in name or ".lora_embedding_B" in name

0 commit comments

Comments
 (0)