| 823 | } |
| 824 | |
| 825 | ggml_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 | |
| 851 | ggml_tensor * llm_graph_context::build_lora_mm_id( |
| 852 | ggml_tensor * w, // ggml_tensor * as |
nothing calls this directly
no test coverage detected