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

Function main

tools/quantize/quantize.cpp:493–756  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

491}
492
493int main(int argc, char ** argv) {
494 std::setlocale(LC_NUMERIC, "C");
495 if (argc < 3) {
496 usage(argv[0]);
497 }
498
499 llama_model_quantize_params params = llama_model_quantize_default_params();
500
501 int arg_idx = 1;
502 std::string imatrix_file;
503 std::vector<std::string> included_weights, excluded_weights;
504 std::vector<llama_model_kv_override> kv_overrides;
505 std::vector<tensor_type_option> tensor_type_opts;
506 std::vector<int> prune_layers;
507
508 for (; arg_idx < argc && strncmp(argv[arg_idx], "--", 2) == 0; arg_idx++) {
509 if (strcmp(argv[arg_idx], "--leave-output-tensor") == 0) {
510 params.quantize_output_tensor = false;
511 } else if (strcmp(argv[arg_idx], "--output-tensor-type") == 0) {
512 if (arg_idx < argc-1) {
513 params.output_tensor_type = parse_ggml_type(argv[++arg_idx]);
514 if (params.output_tensor_type == GGML_TYPE_COUNT) {
515 usage(argv[0]);
516 }
517 } else {
518 usage(argv[0]);
519 }
520 } else if (strcmp(argv[arg_idx], "--token-embedding-type") == 0) {
521 if (arg_idx < argc-1) {
522 params.token_embedding_type = parse_ggml_type(argv[++arg_idx]);
523 if (params.token_embedding_type == GGML_TYPE_COUNT) {
524 usage(argv[0]);
525 }
526 } else {
527 usage(argv[0]);
528 }
529 } else if (strcmp(argv[arg_idx], "--tensor-type") == 0) {
530 if (arg_idx == argc-1 || !parse_tensor_type(argv[++arg_idx], tensor_type_opts)) {
531 usage(argv[0]);
532 }
533 } else if (strcmp(argv[arg_idx], "--tensor-type-file") == 0) {
534 if (arg_idx == argc-1 || !parse_tensor_type_file(argv[++arg_idx], tensor_type_opts)) {
535 usage(argv[0]);
536 }
537 } else if (strcmp(argv[arg_idx], "--prune-layers") == 0) {
538 if (arg_idx == argc-1 || !parse_layer_prune(argv[++arg_idx], prune_layers)) {
539 usage(argv[0]);
540 }
541 } else if (strcmp(argv[arg_idx], "--override-kv") == 0) {
542 if (arg_idx == argc-1 || !string_parse_kv_override(argv[++arg_idx], kv_overrides)) {
543 usage(argv[0]);
544 }
545 } else if (strcmp(argv[arg_idx], "--dry-run") == 0) {
546 params.dry_run = true;
547 } else if (strcmp(argv[arg_idx], "--allow-requantize") == 0) {
548 params.allow_requantize = true;
549 } else if (strcmp(argv[arg_idx], "--pure") == 0) {
550 params.pure = true;

Callers

nothing calls this directly

Calls 15

parse_ggml_typeFunction · 0.85
parse_tensor_typeFunction · 0.85
parse_tensor_type_fileFunction · 0.85
parse_layer_pruneFunction · 0.85
string_parse_kv_overrideFunction · 0.85
prepare_imatrixFunction · 0.85
llama_backend_initFunction · 0.85
try_parse_ftypeFunction · 0.85
llama_time_usFunction · 0.85
llama_model_quantizeFunction · 0.85
llama_backend_freeFunction · 0.85

Tested by

no test coverage detected