File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -248,18 +248,26 @@ struct llama_model * llama_model_load_from_file(
248
248
return llama_model_load_from_file_impl (path_model, splits, params);
249
249
}
250
250
251
- struct llama_model * llama_model_load_from_splits (
252
- const char ** paths,
253
- size_t n_paths,
254
- struct llama_model_params params) {
251
+ namespace {
252
+ std::vector<std::string> splits_from_c_paths (const char ** paths, size_t n_paths) {
255
253
std::vector<std::string> splits;
256
254
if (n_paths == 0 ) {
257
255
LLAMA_LOG_ERROR (" %s: list of splits is empty\n " , __func__);
258
- return nullptr ;
256
+ return splits ;
259
257
}
260
258
for (size_t i = 0 ; i < n_paths; ++i) {
261
259
splits.push_back (paths[i]);
262
260
}
261
+ return splits;
262
+ }
263
+ } // namespace
264
+
265
+ struct llama_model * llama_model_load_from_splits (const char ** paths, size_t n_paths,
266
+ struct llama_model_params params) {
267
+ std::vector<std::string> splits = splits_from_c_paths (paths, n_paths);
268
+ if (splits.empty ()) {
269
+ return nullptr ;
270
+ }
263
271
return llama_model_load_from_file_impl (splits.front (), splits, params);
264
272
}
265
273
You can’t perform that action at this time.
0 commit comments