MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / main

Function main

subprojects/llama.cpp/tools/quantize/quantize.cpp:463–711  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

461}
462
463int main(int argc, char ** argv) {
464 if (argc < 3) {
465 usage(argv[0]);
466 }
467
468 llama_model_quantize_params params = llama_model_quantize_default_params();
469
470 int arg_idx = 1;
471 std::string imatrix_file;
472 std::vector<std::string> included_weights, excluded_weights;
473 std::vector<llama_model_kv_override> kv_overrides;
474 std::vector<tensor_quantization> tensor_types;
475 std::vector<int> prune_layers;
476
477 for (; arg_idx < argc && strncmp(argv[arg_idx], "--", 2) == 0; arg_idx++) {
478 if (strcmp(argv[arg_idx], "--leave-output-tensor") == 0) {
479 params.quantize_output_tensor = false;
480 } else if (strcmp(argv[arg_idx], "--output-tensor-type") == 0) {
481 if (arg_idx < argc-1) {
482 params.output_tensor_type = parse_ggml_type(argv[++arg_idx]);
483 if (params.output_tensor_type == GGML_TYPE_COUNT) {
484 usage(argv[0]);
485 }
486 } else {
487 usage(argv[0]);
488 }
489 } else if (strcmp(argv[arg_idx], "--token-embedding-type") == 0) {
490 if (arg_idx < argc-1) {
491 params.token_embedding_type = parse_ggml_type(argv[++arg_idx]);
492 if (params.token_embedding_type == GGML_TYPE_COUNT) {
493 usage(argv[0]);
494 }
495 } else {
496 usage(argv[0]);
497 }
498 } else if (strcmp(argv[arg_idx], "--tensor-type") == 0) {
499 if (arg_idx == argc-1 || !parse_tensor_type(argv[++arg_idx], tensor_types)) {
500 usage(argv[0]);
501 }
502 } else if (strcmp(argv[arg_idx], "--tensor-type-file") == 0) {
503 if (arg_idx == argc-1 || !parse_tensor_type_file(argv[++arg_idx], tensor_types)) {
504 usage(argv[0]);
505 }
506 } else if (strcmp(argv[arg_idx], "--prune-layers") == 0) {
507 if (arg_idx == argc-1 || !parse_layer_prune(argv[++arg_idx], prune_layers)) {
508 usage(argv[0]);
509 }
510 } else if (strcmp(argv[arg_idx], "--override-kv") == 0) {
511 if (arg_idx == argc-1 || !string_parse_kv_override(argv[++arg_idx], kv_overrides)) {
512 usage(argv[0]);
513 }
514 } else if (strcmp(argv[arg_idx], "--allow-requantize") == 0) {
515 params.allow_requantize = true;
516 } else if (strcmp(argv[arg_idx], "--pure") == 0) {
517 params.pure = true;
518 } else if (strcmp(argv[arg_idx], "--imatrix") == 0) {
519 if (arg_idx < argc-1) {
520 imatrix_file = argv[++arg_idx];

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