diff --git a/examples/cli/main.cpp b/examples/cli/main.cpp index ee02a085..f42c6677 100644 --- a/examples/cli/main.cpp +++ b/examples/cli/main.cpp @@ -699,10 +699,10 @@ int main(int argc, const char* argv[]) { int width, height; input_image_buffer = stbi_load(img_file.c_str(), &width, &height, &c, 3); if (input_image_buffer == NULL) { - fprintf(stderr, "load image from '%s' failed\n", img_file.c_str()); + LOG_ERROR("PhotoMaker load image from '%s' failed", img_file.c_str()); return 1; }else{ - fprintf(stderr, "successfully loaded image from '%s' \n", img_file.c_str()); + LOG_INFO("PhotoMaker loaded image from '%s'", img_file.c_str()); } sd_image_t* input_image = NULL; input_image = new sd_image_t{(uint32_t)width, @@ -711,7 +711,7 @@ int main(int argc, const char* argv[]) { input_image_buffer}; input_image = preprocess_id_image(input_image); if(input_image == NULL){ - fprintf(stderr, "preprocess input id image from '%s' failed\n", img_file.c_str()); + LOG_ERROR("preprocess input id image from '%s' failed", img_file.c_str()); return 1; } input_id_images.push_back(input_image); diff --git a/model.cpp b/model.cpp index 12673de6..c3e68780 100644 --- a/model.cpp +++ b/model.cpp @@ -828,17 +828,7 @@ bool ModelLoader::init_from_safetensors_file(const std::string& file_path, const return false; } } - // fix photomaker model file to remove the following name fix - size_t pos = name.find("layrnorm"); - if(pos != std::string::npos){ - name.replace(pos, strlen("layrnorm"), "layernorm"); - } - if(starts_with(prefix, "pmid")){ - pos = name.find("visual_projection.w"); - if(pos != std::string::npos){ - name.replace(0, 0, "vision_model."); - } - } + TensorStorage tensor_storage(prefix + name, type, ne, n_dims, file_index, ST_HEADER_SIZE_LEN + header_size_ + begin); tensor_storage.reverse_ne(); diff --git a/pmid.hpp b/pmid.hpp index a68ec26b..d41692a7 100644 --- a/pmid.hpp +++ b/pmid.hpp @@ -361,7 +361,7 @@ public: size_t get_params_mem_size() { size_t params_mem_size = vision_model.get_params_mem_size(); params_mem_size += fuse_module.get_params_mem_size(); - params_mem_size += ggml_row_size(wtype, 1280*1024); + params_mem_size += visual_projection_2.get_params_mem_size(); return params_mem_size; } diff --git a/stable-diffusion.cpp b/stable-diffusion.cpp index 22e33760..9f2bbead 100644 --- a/stable-diffusion.cpp +++ b/stable-diffusion.cpp @@ -374,7 +374,7 @@ public: unet_params_mem_size / 1024.0 / 1024.0, vae_params_mem_size / 1024.0 / 1024.0, control_net_params_mem_size / 1024.0 / 1024.0, - pmid_params_mem_size); + pmid_params_mem_size/ 1024.0 / 1024.0); } int64_t t1 = ggml_time_ms();