Skip to content

Commit cb46146

Browse files
committed
Refactor photmaker v2 support
1 parent b465f13 commit cb46146

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

pmid.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ struct PhotoMakerIDEncoder : public GGMLRunner {
631631
if (pm_version == PM_VERSION_1) {
632632
id_encoder.init(params_ctx, tensor_types, prefix);
633633
} else if (pm_version == PM_VERSION_2) {
634-
id_encoder2.init(params_ctx, wtype);
634+
id_encoder2.init(params_ctx, tensor_types, prefix);
635635
}
636636
}
637637

@@ -780,11 +780,10 @@ struct PhotoMakerIDEmbed : public GGMLRunner {
780780
bool applied = false;
781781

782782
PhotoMakerIDEmbed(ggml_backend_t backend,
783-
ggml_type wtype,
784783
ModelLoader* ml,
785784
const std::string& file_path = "",
786785
const std::string& prefix = "")
787-
: file_path(file_path), GGMLRunner(backend, wtype), model_loader(ml) {
786+
: file_path(file_path), GGMLRunner(backend), model_loader(ml) {
788787
if (!model_loader->init_from_file(file_path, prefix)) {
789788
load_failed = true;
790789
}

stable-diffusion.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ class StableDiffusionGGML {
334334
diffusion_model = std::make_shared<FluxModel>(backend, model_loader.tensor_storages_types, version, diffusion_flash_attn);
335335
} else {
336336
if (id_embeddings_path.find("v2") != std::string::npos) {
337-
cond_stage_model = std::make_shared<FrozenCLIPEmbedderWithCustomWords>(clip_backend, conditioner_wtype, embeddings_path, version, PM_VERSION_2);
337+
cond_stage_model = std::make_shared<FrozenCLIPEmbedderWithCustomWords>(clip_backend, model_loader.tensor_storages_types, embeddings_path, version, PM_VERSION_2);
338338
} else {
339339
cond_stage_model = std::make_shared<FrozenCLIPEmbedderWithCustomWords>(clip_backend, model_loader.tensor_storages_types, embeddings_path, version);
340340
}
@@ -374,10 +374,10 @@ class StableDiffusionGGML {
374374
}
375375

376376
if (id_embeddings_path.find("v2") != std::string::npos) {
377-
pmid_model = std::make_shared<PhotoMakerIDEncoder>(backend, model_wtype, version, PM_VERSION_2);
377+
pmid_model = std::make_shared<PhotoMakerIDEncoder>(backend, model_loader.tensor_storages_types, "pmid", version, PM_VERSION_2);
378378
LOG_INFO("using PhotoMaker Version 2");
379379
} else {
380-
pmid_model = std::make_shared<PhotoMakerIDEncoder>(backend,model_loader.tensor_storages_types, "pmid", version);
380+
pmid_model = std::make_shared<PhotoMakerIDEncoder>(backend, model_loader.tensor_storages_types, "pmid", version);
381381
}
382382
if (id_embeddings_path.size() > 0) {
383383
pmid_lora = std::make_shared<LoraModel>(backend, id_embeddings_path, "");

0 commit comments

Comments
 (0)