mirror of
https://github.com/leejet/stable-diffusion.cpp.git
synced 2026-11-11 19:36:33 +00:00
remove tensor renaming; fixing names in the photomaker model file
This commit is contained in:
1 parent
77b6a42bc3
commit
464f1f8d8b
4 files changed
+6
-16
No files matched your search
@@ -699,10 +699,10 @@ int main(int argc, const char* argv[]) {
|
|||||||
int width, height;
|
int width, height;
|
||||||
input_image_buffer = stbi_load(img_file.c_str(), &width, &height, &c, 3);
|
input_image_buffer = stbi_load(img_file.c_str(), &width, &height, &c, 3);
|
||||||
if (input_image_buffer == NULL) {
|
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;
|
return 1;
|
||||||
}else{
|
}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;
|
sd_image_t* input_image = NULL;
|
||||||
input_image = new sd_image_t{(uint32_t)width,
|
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_buffer};
|
||||||
input_image = preprocess_id_image(input_image);
|
input_image = preprocess_id_image(input_image);
|
||||||
if(input_image == NULL){
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
input_id_images.push_back(input_image);
|
input_id_images.push_back(input_image);
|
||||||
|
|||||||
@@ -828,17 +828,7 @@ bool ModelLoader::init_from_safetensors_file(const std::string& file_path, const
|
|||||||
return false;
|
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);
|
TensorStorage tensor_storage(prefix + name, type, ne, n_dims, file_index, ST_HEADER_SIZE_LEN + header_size_ + begin);
|
||||||
tensor_storage.reverse_ne();
|
tensor_storage.reverse_ne();
|
||||||
|
|
||||||
|
|||||||
@@ -361,7 +361,7 @@ public:
|
|||||||
size_t get_params_mem_size() {
|
size_t get_params_mem_size() {
|
||||||
size_t params_mem_size = vision_model.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 += 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;
|
return params_mem_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -374,7 +374,7 @@ public:
|
|||||||
unet_params_mem_size / 1024.0 / 1024.0,
|
unet_params_mem_size / 1024.0 / 1024.0,
|
||||||
vae_params_mem_size / 1024.0 / 1024.0,
|
vae_params_mem_size / 1024.0 / 1024.0,
|
||||||
control_net_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();
|
int64_t t1 = ggml_time_ms();
|
||||||
|
|||||||
Reference in new issue
Block a user