Skip to content

Commit eed5577

Browse files
authored
fix unintended sd model quantization (#1672)
The recent ggml update added another quant type, GGML_TYPE_MXFP4, which got the same value as SD_TYPE_COUNT. That made the embedded sd.cpp quantize to GGML_TYPE_MXFP4 by default. Photomaker in particular ends up crashing due to "Missing CPY op for types: f32 mxfp4".
1 parent 8f15461 commit eed5577

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

otherarch/sdcpp/sdtype_adapter.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
// #define STB_IMAGE_RESIZE_IMPLEMENTATION //already defined in llava
3636
#include "stb_image_resize.h"
3737

38+
static_assert((int)SD_TYPE_COUNT == (int)GGML_TYPE_COUNT,
39+
"inconsistency between SD_TYPE_COUNT and GGML_TYPE_COUNT");
40+
3841
enum SDMode {
3942
TXT2IMG,
4043
IMG2IMG,

otherarch/sdcpp/stable-diffusion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ enum sd_type_t {
100100
SD_TYPE_IQ4_NL_4_4 = 36,
101101
// SD_TYPE_IQ4_NL_4_8 = 37,
102102
// SD_TYPE_IQ4_NL_8_8 = 38,
103-
SD_TYPE_COUNT = 39,
103+
SD_TYPE_COUNT = 40,
104104
};
105105

106106
SD_API const char* sd_type_name(enum sd_type_t type);

0 commit comments

Comments
 (0)