File tree Expand file tree Collapse file tree 1 file changed +10
-11
lines changed
Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ struct LoraModel : public GGMLRunner {
115115 return " lora" ;
116116 }
117117
118- bool load_from_file (bool filter_tensor = false ) {
118+ bool load_from_file (bool filter_tensor = false , int n_threads = 0 ) {
119119 LOG_INFO (" loading LoRA from '%s'" , file_path.c_str ());
120120
121121 if (load_failed) {
@@ -131,15 +131,14 @@ struct LoraModel : public GGMLRunner {
131131 // LOG_INFO("skipping LoRA tesnor '%s'", name.c_str());
132132 return true ;
133133 }
134- // LOG_INFO("lora_tensor %s", name.c_str());
135- for (int i = 0 ; i < LORA_TYPE_COUNT; i++) {
136- if (name.find (type_fingerprints[i]) != std::string::npos) {
137- type = (lora_t )i;
138- break ;
139- }
140- }
141134
142135 if (dry_run) {
136+ for (int i = 0 ; i < LORA_TYPE_COUNT; i++) {
137+ if (name.find (type_fingerprints[i]) != std::string::npos) {
138+ type = (lora_t )i;
139+ break ;
140+ }
141+ }
143142 struct ggml_tensor * real = ggml_new_tensor (params_ctx,
144143 tensor_storage.type ,
145144 tensor_storage.n_dims ,
@@ -153,11 +152,11 @@ struct LoraModel : public GGMLRunner {
153152 return true ;
154153 };
155154
156- model_loader.load_tensors (on_new_tensor_cb);
155+ model_loader.load_tensors (on_new_tensor_cb, 1 );
157156 alloc_params_buffer ();
158- // exit(0);
157+
159158 dry_run = false ;
160- model_loader.load_tensors (on_new_tensor_cb);
159+ model_loader.load_tensors (on_new_tensor_cb, n_threads );
161160
162161 LOG_DEBUG (" lora type: \" %s\" /\" %s\" " , lora_downs[type].c_str (), lora_ups[type].c_str ());
163162
You can’t perform that action at this time.
0 commit comments