]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
ggml : ggml_type_name return "NONE" for invalid values (#9458)
authorYuri Khrustalev <redacted>
Sat, 14 Sep 2024 09:54:37 +0000 (05:54 -0400)
committerGitHub <redacted>
Sat, 14 Sep 2024 09:54:37 +0000 (12:54 +0300)
When running on Windows, the quantization utility attempts to print the types that are not set which leads to a crash.

ggml/src/ggml.c

index 493ff7fc072db60c83a0e5b7cd243d918df77287..490c8d602853bde173fa8990a3fd1236ed6f1d85 100644 (file)
@@ -3399,7 +3399,7 @@ double ggml_type_sizef(enum ggml_type type) {
 }
 
 GGML_CALL const char * ggml_type_name(enum ggml_type type) {
-    return type_traits[type].type_name;
+    return type < GGML_TYPE_COUNT ? type_traits[type].type_name : "NONE";
 }
 
 GGML_CALL bool ggml_is_quantized(enum ggml_type type) {