MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / build_lora_mm

Method build_lora_mm

subprojects/llama.cpp/src/llama-graph.cpp:825–849  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

823}
824
825ggml_tensor * llm_graph_context::build_lora_mm(
826 ggml_tensor * w,
827 ggml_tensor * cur) const {
828 ggml_tensor * res = ggml_mul_mat(ctx0, w, cur);
829
830 for (const auto & lora : *loras) {
831 llama_adapter_lora_weight * lw = lora.first->get_weight(w);
832 if (lw == nullptr) {
833 continue;
834 }
835
836 const float adapter_scale = lora.second;
837 const float scale = lw->get_scale(lora.first->alpha, adapter_scale);
838
839 ggml_tensor * ab_cur = ggml_mul_mat(
840 ctx0, lw->b,
841 ggml_mul_mat(ctx0, lw->a, cur)
842 );
843
844 ab_cur = ggml_scale(ctx0, ab_cur, scale);
845 res = ggml_add(ctx0, res, ab_cur);
846 }
847
848 return res;
849}
850
851ggml_tensor * llm_graph_context::build_lora_mm_id(
852 ggml_tensor * w, // ggml_tensor * as

Callers

nothing calls this directly

Calls 5

ggml_mul_matFunction · 0.85
ggml_scaleFunction · 0.85
ggml_addFunction · 0.85
get_scaleMethod · 0.80
get_weightMethod · 0.45

Tested by

no test coverage detected