split : minor style + fix compile warnings
This commit is contained in:
parent
b3a94dd9e0
commit
7f0e73b27a
1 changed files with 85 additions and 88 deletions
|
@ -149,7 +149,6 @@ static std::string split_file_name(const std::string & path, int i_split, int n_
|
||||||
}
|
}
|
||||||
|
|
||||||
struct split_strategy {
|
struct split_strategy {
|
||||||
|
|
||||||
const split_params params;
|
const split_params params;
|
||||||
std::ifstream & f_input;
|
std::ifstream & f_input;
|
||||||
struct gguf_context * ctx_gguf;
|
struct gguf_context * ctx_gguf;
|
||||||
|
@ -193,8 +192,7 @@ struct split_strategy {
|
||||||
gguf_set_val_u8(ctx_out, LLM_KV_GENERAL_SPLIT_N_SPLIT, n_split);
|
gguf_set_val_u8(ctx_out, LLM_KV_GENERAL_SPLIT_N_SPLIT, n_split);
|
||||||
|
|
||||||
// populate the original tensors, so we get an initial metadata
|
// populate the original tensors, so we get an initial metadata
|
||||||
for (int i = i_split * params.n_split_tensors; i < n_tensors
|
for (int i = i_split * params.n_split_tensors; i < n_tensors && i < (i_split + 1) * params.n_split_tensors; ++i) {
|
||||||
&& i < (i_split + 1) * params.n_split_tensors; ++i) {
|
|
||||||
struct ggml_tensor * meta = ggml_get_tensor(ctx_meta, gguf_get_tensor_name(ctx_gguf, i));
|
struct ggml_tensor * meta = ggml_get_tensor(ctx_meta, gguf_get_tensor_name(ctx_gguf, i));
|
||||||
gguf_add_tensor(ctx_out, meta);
|
gguf_add_tensor(ctx_out, meta);
|
||||||
}
|
}
|
||||||
|
@ -481,10 +479,8 @@ static void gguf_merge(const split_params & split_params) {
|
||||||
static void gguf_upload(const split_params & /*params*/) {
|
static void gguf_upload(const split_params & /*params*/) {
|
||||||
#ifdef LLAMA_USE_CURL
|
#ifdef LLAMA_USE_CURL
|
||||||
fprintf(stderr, "%s: NOT IMPLEMENTED\n", __func__);
|
fprintf(stderr, "%s: NOT IMPLEMENTED\n", __func__);
|
||||||
exit(-1);
|
|
||||||
#else
|
#else
|
||||||
fprintf(stderr, "%s: operation upload not supported, please build with -DLLAMA_CURL\n", __func__);
|
fprintf(stderr, "%s: operation upload not supported, please build with -DLLAMA_CURL\n", __func__);
|
||||||
exit(1);
|
|
||||||
#endif // LLAMA_USE_CURL
|
#endif // LLAMA_USE_CURL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -497,14 +493,15 @@ int main(int argc, const char ** argv) {
|
||||||
split_params_parse(argc, argv, params);
|
split_params_parse(argc, argv, params);
|
||||||
|
|
||||||
switch (params.operation) {
|
switch (params.operation) {
|
||||||
case SPLIT_OP_SPLIT:gguf_split(params);
|
case SPLIT_OP_SPLIT: gguf_split(params);
|
||||||
break;
|
break;
|
||||||
case SPLIT_OP_MERGE:gguf_merge(params);
|
case SPLIT_OP_MERGE: gguf_merge(params);
|
||||||
break;
|
break;
|
||||||
case SPLIT_OP_UPLOAD:gguf_upload(params);
|
case SPLIT_OP_UPLOAD: gguf_upload(params);
|
||||||
break;
|
break;
|
||||||
default:split_print_usage(argv[0]);
|
default:split_print_usage(argv[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
exit(0);
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue