diff --git a/ggml b/ggml index 21d3a308f..75c806fd9 160000 --- a/ggml +++ b/ggml @@ -1 +1 @@ -Subproject commit 21d3a308fcb7f31cb9beceaeebad4fb622f3c337 +Subproject commit 75c806fd93b0dde6297e4b4284bfdd7abe8317ab diff --git a/ggml_extend.hpp b/ggml_extend.hpp index e50137d5e..6c40c4a6b 100644 --- a/ggml_extend.hpp +++ b/ggml_extend.hpp @@ -100,20 +100,21 @@ __STATIC_INLINE__ ggml_fp16_t ggml_tensor_get_f16(const ggml_tensor* tensor, int static struct ggml_tensor* get_tensor_from_graph(struct ggml_cgraph* gf, const char* name) { struct ggml_tensor* res = NULL; - for (int i = 0; i < gf->n_nodes; i++) { - // printf("%d, %s \n", i, gf->nodes[i]->name); - if (strcmp(ggml_get_name(gf->nodes[i]), name) == 0) { - res = gf->nodes[i]; - break; - } - } - for (int i = 0; i < gf->n_leafs; i++) { - // printf("%d, %s \n", i, gf->leafs[i]->name); - if (strcmp(ggml_get_name(gf->leafs[i]), name) == 0) { - res = gf->leafs[i]; + for (int i = 0; i < ggml_graph_n_nodes(gf); i++) { + struct ggml_tensor* node = ggml_graph_node(gf, i); + // printf("%d, %s \n", i, ggml_get_name(node)); + if (strcmp(ggml_get_name(node), name) == 0) { + res = node; break; } } + //for (int i = 0; i < gf->n_leafs; i++) { + // // printf("%d, %s \n", i, gf->leafs[i]->name); + // if (strcmp(ggml_get_name(gf->leafs[i]), name) == 0) { + // res = gf->leafs[i]; + // break; + // } + //} return res; } @@ -1118,7 +1119,7 @@ struct GGMLRunner { ggml_graph_print(gf); #endif if (output != NULL) { - auto result = gf->nodes[gf->n_nodes - 1]; + auto result = ggml_graph_node(gf, -1); if (*output == NULL && output_ctx != NULL) { *output = ggml_dup_tensor(output_ctx, result); } diff --git a/stable-diffusion.cpp b/stable-diffusion.cpp index 4d28a147b..f0817ea03 100644 --- a/stable-diffusion.cpp +++ b/stable-diffusion.cpp @@ -47,6 +47,8 @@ const char* sampling_methods_str[] = { "LCM", }; +//static_assert((int)SD_TYPE_COUNT == (int)GGML_TYPE_COUNT); + /*================================================== Helper Functions ================================================*/ void calculate_alphas_cumprod(float* alphas_cumprod, diff --git a/stable-diffusion.h b/stable-diffusion.h index 812e8fc94..0d632dd1c 100644 --- a/stable-diffusion.h +++ b/stable-diffusion.h @@ -93,6 +93,8 @@ enum sd_type_t { SD_TYPE_Q4_0_4_4 = 31, SD_TYPE_Q4_0_4_8 = 32, SD_TYPE_Q4_0_8_8 = 33, + SD_TYPE_TQ1_0 = 34, + SD_TYPE_TQ2_0 = 35, SD_TYPE_COUNT, };