mirror of
https://github.com/leejet/stable-diffusion.cpp.git
synced 2026-11-11 11:26:34 +00:00
feat: add P-H3-Image generation and editing support (#2272)
This commit is contained in:
1 parent
984eb0686c
commit
3e92bf990a
18 files changed
+421
-41
No files matched your search
@@ -578,6 +578,25 @@ SDVersion ModelLoader::get_sd_version() const {
|
||||
}
|
||||
if (tensor_storage.name.find("model.diffusion_model.video_patch_proj.weight") != std::string::npos &&
|
||||
tensor_storage_map.find("model.diffusion_model.audio_patch_proj.weight") != tensor_storage_map.end()) {
|
||||
// P-H3 uses the same DiT architecture as H3; its VAE or connector identifies the image pipeline.
|
||||
auto decoder = tensor_storage_map.find("first_stage_model.decoder.proj_out.weight");
|
||||
if (decoder == tensor_storage_map.end()) {
|
||||
decoder = tensor_storage_map.find("vae.decoder.proj_out.weight");
|
||||
}
|
||||
if (decoder != tensor_storage_map.end() && decoder->second.ne[1] == 768) {
|
||||
return VERSION_P_H3_IMAGE;
|
||||
}
|
||||
for (const std::string prefix : {"", "embeddings_connectors."}) {
|
||||
if (tensor_storage_map.count(prefix + "text_encoders.ph3_image_connector.proj.weight") ||
|
||||
tensor_storage_map.count(prefix + "text_encoders.llm.text_connector.proj.weight")) {
|
||||
return VERSION_P_H3_IMAGE;
|
||||
}
|
||||
}
|
||||
auto connector = tensor_storage_map.find("embeddings_connectors.proj.weight");
|
||||
if (connector != tensor_storage_map.end() && connector->second.ne[0] == 12800 &&
|
||||
connector->second.ne[1] == 5120 && tensor_storage_map.count("embeddings_connectors.sink_embedding")) {
|
||||
return VERSION_P_H3_IMAGE;
|
||||
}
|
||||
return VERSION_MINIMAX_H3;
|
||||
}
|
||||
if (name == "model.diffusion_model.y_embedder.layer_pool.weight" &&
|
||||
|
||||
Reference in new issue
Block a user