diff --git a/koboldcpp.py b/koboldcpp.py index 2be2a1b330197..8f7bd24722579 100644 --- a/koboldcpp.py +++ b/koboldcpp.py @@ -1899,7 +1899,7 @@ def togglehorde(a,b,c): # Image Gen Tab images_tab = tabcontent["Image Gen"] - makefileentry(images_tab, "Stable Diffusion Model (f16 safetensors):", "Select Stable Diffusion Model File", sd_model_var, 1, filetypes=[("*.safetensors","*.safetensors")], tooltiptxt="Select a .safetensors Stable Diffusion model file on disk to be loaded.") + makefileentry(images_tab, "Stable Diffusion Model (safetensors/gguf):", "Select Stable Diffusion Model File", sd_model_var, 1, filetypes=[("*.safetensors *.gguf","*.safetensors *.gguf")], tooltiptxt="Select a .safetensors or .gguf Stable Diffusion model file on disk to be loaded.") makecheckbox(images_tab, "Quick Mode (Low Quality)", sd_quick_var, 4,tooltiptxt="Force optimal generation settings for speed.") makelabelentry(images_tab, "Image threads:" , sd_threads_var, 6, 50,"How many threads to use during image generation.\nIf left blank, uses same value as threads.") makecheckbox(images_tab, "Compress Weights (Saves Memory)", sd_quant_var, 8,tooltiptxt="Quantizes the SD model weights to save memory. May degrade quality.") diff --git a/otherarch/ggml_v3.c b/otherarch/ggml_v3.c index 119902a5e5fe4..33ada25e49262 100644 --- a/otherarch/ggml_v3.c +++ b/otherarch/ggml_v3.c @@ -20058,6 +20058,12 @@ struct gguf_v3_context * gguf_v3_init_from_file(const char * fname, struct gguf_ fprintf(stderr, "%s: GGUFv1 is deprecated. please update if possible.\n", __func__); } + // sanity-checks to prevent from integer/buffer overflows + + ok = ok && (ctx->header.n_tensors < (SIZE_MAX/2)/sizeof(struct gguf_v3_tensor_info)); + ok = ok && (ctx->header.n_tensors < (SIZE_MAX/2)/ggml_v3_tensor_overhead()); + ok = ok && (ctx->header.n_kv < (SIZE_MAX/2)/sizeof(struct gguf_v3_kv)); + if (!ok) { fprintf(stderr, "%s: failed to read header\n", __func__); fclose(file); diff --git a/otherarch/sdcpp/model.cpp b/otherarch/sdcpp/model.cpp index 7a0efa75e6737..58cdd939af585 100644 --- a/otherarch/sdcpp/model.cpp +++ b/otherarch/sdcpp/model.cpp @@ -675,10 +675,13 @@ bool ModelLoader::init_from_file(const std::string& file_path, const std::string } else if (is_safetensors_file(file_path)) { LOG_INFO("load %s using safetensors format", file_path.c_str()); return init_from_safetensors_file(file_path, prefix); - } else if (is_zip_file(file_path)) { - LOG_INFO("load %s using checkpoint format", file_path.c_str()); - return init_from_ckpt_file(file_path, prefix); - } else { + } + //disable ckpt loading + // else if (is_zip_file(file_path)) { + // LOG_INFO("load %s using checkpoint format", file_path.c_str()); + // return init_from_ckpt_file(file_path, prefix); + // } else + { LOG_WARN("unknown format %s", file_path.c_str()); return false; }