fix: simplify PuLID ID extraction setup (#1664)

This commit is contained in:
leejet
2026-06-15 23:55:38 +08:00
committed by GitHub
parent 93527fda74
commit 146b6cc49e
10 changed files with 85 additions and 257 deletions

View File

@@ -195,15 +195,6 @@ typedef struct {
const sd_embedding_t* embeddings;
uint32_t embedding_count;
const char* photo_maker_path;
/**
* Path to pulid_flux_v0.9.1.safetensors (the PuLID identity-injection
* cross-attention weights). When set together with sd_img_gen_params_t.
* pulid_params.id_embedding_path, the Flux diffusion model performs PuLID
* cross-attention injection during the denoise loop. Loaded once with
* the model; the embedding is per-generation. Currently only meaningful
* for Flux (depth=19 double, 38 single blocks); silently ignored for
* other model versions.
*/
const char* pulid_weights_path;
const char* tensor_type_rules;
int n_threads;
@@ -282,23 +273,9 @@ typedef struct {
float style_strength;
} sd_pm_params_t; // photo maker
/**
* PuLID-Flux identity preservation params.
*
* Unlike PhotoMaker (which extracts the ID embedding inside the inference
* process from a directory of images), PuLID's ID extraction is a heavy
* Python-only stack (insightface ArcFace + EVA-CLIP-L + IDFormer). To stay
* cross-vendor in C++/Vulkan, sd.cpp consumes a precomputed binary file
* produced by an external tool (runtime-scripts/pulid_extract_id.py in the
* Cloudhands client tree).
*
* Format: a gguf container with a single tensor "pulid_id" of shape
* [token_dim, num_tokens] (ggml order; typically [2048, 32]) in F16/F32/BF16.
* Loaded with the standard gguf reader; see docs/pulid.md.
*/
typedef struct {
const char* id_embedding_path; // path to .pulidembd file produced by pulid_extract_id.py
float id_weight; // strength of the ID injection; typical 0.7-1.2, default 1.0
const char* id_embedding_path;
float id_weight;
} sd_pulid_params_t;
enum sd_cache_mode_t {