@@ -1759,8 +1759,12 @@ int llama_model_quantize(
1759
1759
1760
1760
int llama_apply_lora_from_file (struct llama_context * ctx, const char * path_lora, int n_threads) {
1761
1761
// TODO: refactor all of this after PR #801
1762
+ fprintf (stderr, " %s: applying lora adapter from '%s' - please wait ...\n " , __func__, path_lora);
1763
+
1762
1764
auto & model = ctx->model ;
1763
1765
1766
+ const int64_t t_start_lora_us = ggml_time_us ();
1767
+
1764
1768
auto fin = std::ifstream (path_lora, std::ios::binary);
1765
1769
if (!fin) {
1766
1770
fprintf (stderr, " %s: failed to open '%s'\n " , __func__, path_lora);
@@ -1873,7 +1877,7 @@ int llama_apply_lora_from_file(struct llama_context * ctx, const char * path_lor
1873
1877
lora_tensors.find (base_name + " .loraB" ) != lora_tensors.end ()) {
1874
1878
1875
1879
ggml_tensor * tensor = model.tensors [base_name];
1876
- ggml_tensor * loraA = ggml_transpose (lora_ctx, lora_tensors[base_name + " .loraA" ]) ;
1880
+ ggml_tensor * loraA = lora_tensors[base_name + " .loraA" ];
1877
1881
ggml_tensor * loraB = lora_tensors[base_name + " .loraB" ];
1878
1882
1879
1883
if (tensor->ne [0 ] != loraA->ne [1 ]) {
@@ -1900,7 +1904,11 @@ int llama_apply_lora_from_file(struct llama_context * ctx, const char * path_lor
1900
1904
fprintf (stderr, " ." );
1901
1905
}
1902
1906
}
1903
- fprintf (stderr, " done\n " );
1907
+
1908
+ ggml_free (lora_ctx);
1909
+
1910
+ const int64_t t_lora_us = ggml_time_us () - t_start_lora_us;
1911
+ fprintf (stderr, " done (%.2f ms)\n " , t_lora_us / 1000.0 );
1904
1912
1905
1913
return 0 ;
1906
1914
}
0 commit comments