split : minor style + fix compile warnings

This commit is contained in:
Georgi Gerganov 2024-03-19 11:17:29 +02:00
parent b3a94dd9e0
commit 7f0e73b27a
No known key found for this signature in database
GPG key ID: 449E073F9DC10735

View file

@ -149,7 +149,6 @@ static std::string split_file_name(const std::string & path, int i_split, int n_
}
struct split_strategy {
const split_params params;
std::ifstream & f_input;
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);
// populate the original tensors, so we get an initial metadata
for (int i = i_split * params.n_split_tensors; i < n_tensors
&& i < (i_split + 1) * params.n_split_tensors; ++i) {
for (int i = i_split * params.n_split_tensors; i < n_tensors && 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));
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*/) {
#ifdef LLAMA_USE_CURL
fprintf(stderr, "%s: NOT IMPLEMENTED\n", __func__);
exit(-1);
#else
fprintf(stderr, "%s: operation upload not supported, please build with -DLLAMA_CURL\n", __func__);
exit(1);
#endif // LLAMA_USE_CURL
}
@ -497,14 +493,15 @@ int main(int argc, const char ** argv) {
split_params_parse(argc, argv, params);
switch (params.operation) {
case SPLIT_OP_SPLIT:gguf_split(params);
case SPLIT_OP_SPLIT: gguf_split(params);
break;
case SPLIT_OP_MERGE:gguf_merge(params);
case SPLIT_OP_MERGE: gguf_merge(params);
break;
case SPLIT_OP_UPLOAD:gguf_upload(params);
case SPLIT_OP_UPLOAD: gguf_upload(params);
break;
default:split_print_usage(argv[0]);
exit(1);
}
exit(0);
return 0;
}