From b562d1681d3865f3799fe2cd33dbf43f7151495f Mon Sep 17 00:00:00 2001 From: ElMiloPy <128089458+ElMiloPy@users.noreply.github.com> Date: Wed, 9 Oct 2024 21:43:19 +0000 Subject: [PATCH 1/3] add other quantization types --- examples/cli/main.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/examples/cli/main.cpp b/examples/cli/main.cpp index ceae27b83..559ae879f 100644 --- a/examples/cli/main.cpp +++ b/examples/cli/main.cpp @@ -336,14 +336,58 @@ void parse_args(int argc, const char** argv, SDParams& params) { params.wtype = SD_TYPE_Q5_1; } else if (type == "q8_0") { params.wtype = SD_TYPE_Q8_0; + } else if (type == "q8_1") { + params.wtype = SD_TYPE_Q8_1; } else if (type == "q2_k") { params.wtype = SD_TYPE_Q2_K; } else if (type == "q3_k") { params.wtype = SD_TYPE_Q3_K; } else if (type == "q4_k") { params.wtype = SD_TYPE_Q4_K; + } else if (type == "q5_k") { + params.wtype = SD_TYPE_Q5_K; + } else if (type == "q6_k") { + params.wtype = SD_TYPE_Q6_K; + } else if (type == "q8_k") { + params.wtype = SD_TYPE_Q8_K; + } else if (type == "iq2_xxs") { + params.wtype = SD_TYPE_IQ2_XXS; + } else if (type == "iq2_xs") { + params.wtype = SD_TYPE_IQ2_XS; + } else if (type == "iq3_xxs") { + params.wtype = SD_TYPE_IQ3_XXS; + } else if (type == "iq1_s") { + params.wtype = SD_TYPE_IQ1_S; + } else if (type == "iq4_nl") { + params.wtype = SD_TYPE_IQ4_NL; + } else if (type == "iq3_s") { + params.wtype = SD_TYPE_IQ3_S; + } else if (type == "iq2_s") { + params.wtype = SD_TYPE_IQ2_S; + } else if (type == "iq4_xs") { + params.wtype = SD_TYPE_IQ4_XS; + } else if (type == "i8") { + params.wtype = SD_TYPE_I8; + } else if (type == "i16") { + params.wtype = SD_TYPE_I16; + } else if (type == "i32") { + params.wtype = SD_TYPE_I32; + } else if (type == "i64") { + params.wtype = SD_TYPE_I64; + } else if (type == "f64") { + params.wtype = SD_TYPE_F64; + } else if (type == "iq1_m") { + params.wtype = SD_TYPE_IQ1_M; + } else if (type == "bf16") { + params.wtype = SD_TYPE_BF16; + } else if (type == "q4_0_4_4") { + params.wtype = SD_TYPE_Q4_0_4_4; + } else if (type == "q4_0_4_8") { + params.wtype = SD_TYPE_Q4_0_4_8; + } else if (type == "q4_0_8_8") { + params.wtype = SD_TYPE_Q4_0_8_8; } else { - fprintf(stderr, "error: invalid weight format %s, must be one of [f32, f16, q4_0, q4_1, q5_0, q5_1, q8_0, q2_k, q3_k, q4_k]\n", + fprintf(stderr, "error: invalid weight format %s, must be one of [f32, f16, q4_0, q4_1, q5_0, q5_1, q8_0, q8_1, q2_k, q3_k, q4_k, q5_k, q6_k, q8_k, iq2_xxs, iq2_xs, iq3_xxs, iq1_s, iq4_nl, iq3_s, iq2_s, iq4_xs, i8, i16, i32, i64, f64, iq1_m, bf16, q4_0_4_4, q4_0_4_8, q4_0_8_8]\n", type.c_str()); exit(1); } From 4a04d456a5e5a6d35bf218574ed2fb3c3d6bbd76 Mon Sep 17 00:00:00 2001 From: ElMiloPy <128089458+ElMiloPy@users.noreply.github.com> Date: Wed, 9 Oct 2024 21:54:28 +0000 Subject: [PATCH 2/3] update README.md and Help info --- README.md | 2 +- examples/cli/main.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0fe607e27..a6e8e3b37 100644 --- a/README.md +++ b/README.md @@ -212,7 +212,7 @@ arguments: --normalize-input normalize PHOTOMAKER input id images --upscale-model [ESRGAN_PATH] path to esrgan model. Upscale images after generate, just RealESRGAN_x4plus_anime_6B supported by now. --upscale-repeats Run the ESRGAN upscaler this many times (default 1) - --type [TYPE] weight type (f32, f16, q4_0, q4_1, q5_0, q5_1, q8_0, q2_k, q3_k, q4_k) + --type [TYPE] weight type (f32, f16, q4_0, q4_1, q5_0, q5_1, q8_0, q8_1, q2_k, q3_k, q4_k, q5_k, q6_k, q8_k, iq2_xxs, iq2_xs, iq3_xxs, iq1_s, iq4_nl, iq3_s, iq2_s, iq4_xs, i8, i16, i32, i64, f64, iq1_m, bf16, q4_0_4_4, q4_0_4_8, q4_0_8_8) If not specified, the default is the type of the weight file. --lora-model-dir [DIR] lora model directory -i, --init-img [IMAGE] path to the input image, required by img2img diff --git a/examples/cli/main.cpp b/examples/cli/main.cpp index 559ae879f..e9f7b3936 100644 --- a/examples/cli/main.cpp +++ b/examples/cli/main.cpp @@ -186,7 +186,7 @@ void print_usage(int argc, const char* argv[]) { printf(" --normalize-input normalize PHOTOMAKER input id images\n"); printf(" --upscale-model [ESRGAN_PATH] path to esrgan model. Upscale images after generate, just RealESRGAN_x4plus_anime_6B supported by now.\n"); printf(" --upscale-repeats Run the ESRGAN upscaler this many times (default 1)\n"); - printf(" --type [TYPE] weight type (f32, f16, q4_0, q4_1, q5_0, q5_1, q8_0, q2_k, q3_k, q4_k)\n"); + printf(" --type [TYPE] weight type (f32, f16, q4_0, q4_1, q5_0, q5_1, q8_0, q8_1, q2_k, q3_k, q4_k, q5_k, q6_k, q8_k, iq2_xxs, iq2_xs, iq3_xxs, iq1_s, iq4_nl, iq3_s, iq2_s, iq4_xs, i8, i16, i32, i64, f64, iq1_m, bf16, q4_0_4_4, q4_0_4_8, q4_0_8_8)\n"); printf(" If not specified, the default is the type of the weight file.\n"); printf(" --lora-model-dir [DIR] lora model directory\n"); printf(" -i, --init-img [IMAGE] path to the input image, required by img2img\n"); From 430f1528463887bdca5d0f2268d7aa5d73336a5f Mon Sep 17 00:00:00 2001 From: ElMiloPy <128089458+ElMiloPy@users.noreply.github.com> Date: Wed, 9 Oct 2024 19:50:34 -0300 Subject: [PATCH 3/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a6e8e3b37..132350813 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ If the built product does not meet your requirements, you can choose to build it ### Get the Code ``` -git clone --recursive https://github.com/leejet/stable-diffusion.cpp +git clone --recursive https://github.com/ElMiloPy/stable-diffusion.cpp cd stable-diffusion.cpp ```