Skip to content

Commit 0615cdd

Browse files
committed
correct comment
1 parent b37af14 commit 0615cdd

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

convert_lora_to_gguf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,8 @@ def modify_tensors(self, data_torch: Tensor, name: str, bid: int | None) -> Iter
433433
assert isinstance(dest_data, LoraTorchTensor)
434434
lora_a, lora_b = dest_data.get_lora_A_B()
435435

436-
# token_embd A and B are already transposed by mergekit-extract-lora
437-
# we transpose A back again because it is used by llm_build_inp_embd()
436+
# note: mergekit-extract-lora flip and transpose A and B
437+
# here we only need to transpose token_embd.lora_a, see llm_build_inp_embd()
438438
if "token_embd.weight" in dest_name:
439439
lora_a = lora_a.T
440440

src/llama-adapter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ static void llama_lora_adapter_init_impl(struct llama_model & model, const char
270270
struct ggml_context * dev_ctx = ctx_for_buft(ggml_backend_buffer_get_type(model_tensor->buffer));
271271
// validate tensor shape
272272
if (is_token_embd) {
273-
// expect B to be transposed, see llm_build_inp_embd()
273+
// expect B to be non-transposed, A and B are flipped; see llm_build_inp_embd()
274274
if (model_tensor->ne[0] != w.b->ne[1] || model_tensor->ne[1] != w.a->ne[1]) {
275275
throw std::runtime_error("tensor '" + name + "' has incorrect shape");
276276
}

0 commit comments

Comments
 (0)