MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / gguf_split

Function gguf_split

tools/gguf-split/gguf-split.cpp:364–400  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

362};
363
364static void gguf_split(const split_params & split_params) {
365 struct ggml_context * ctx_meta = NULL;
366
367 struct gguf_init_params params = {
368 /*.no_alloc = */ true,
369 /*.ctx = */ &ctx_meta,
370 };
371
372 std::ifstream f_input(split_params.input.c_str(), std::ios::binary);
373 if (!f_input.is_open()) {
374 fprintf(stderr, "%s: failed to open input GGUF from %s\n", __func__, split_params.input.c_str());
375 exit(EXIT_FAILURE);
376 }
377
378 auto * ctx_gguf = gguf_init_from_file(split_params.input.c_str(), params);
379 if (!ctx_gguf) {
380 fprintf(stderr, "%s: failed to load input GGUF from %s\n", __func__, split_params.input.c_str());
381 exit(EXIT_FAILURE);
382 }
383
384 // prepare the strategy
385 split_strategy strategy(split_params, f_input, ctx_gguf, ctx_meta);
386 int n_split = strategy.ctx_outs.size();
387 strategy.print_info();
388
389 if (!split_params.dry_run) {
390 // write all output splits
391 strategy.write();
392 }
393
394 // done, clean up
395 gguf_free(ctx_gguf);
396 f_input.close();
397
398 fprintf(stderr, "%s: %d gguf split written with a total of %d tensors.\n",
399 __func__, n_split, strategy.n_tensors);
400}
401
402static void gguf_merge(const split_params & split_params) {
403 fprintf(stderr, "%s: %s -> %s\n",

Callers 1

mainFunction · 0.85

Calls 6

gguf_init_from_fileFunction · 0.85
gguf_freeFunction · 0.85
sizeMethod · 0.45
print_infoMethod · 0.45
writeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected