Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -44,7 +44,8 @@ BRA_FILE = "beautifulRealistic_v7.safetensors"
|
|
| 44 |
BRA_REV = "801a9b1999dd7018e58a1e2b432fdccd3d1d723d" # 固定 revision
|
| 45 |
|
| 46 |
# --- IP-Adapter 本体 & LoRA ---
|
| 47 |
-
|
|
|
|
| 48 |
LORA_REPO,IP_LORA = "h94/IP-Adapter-FaceID", "ip-adapter-faceid-plusv2_sd15_lora.safetensors"
|
| 49 |
|
| 50 |
# --- ControlNet (MediaPipe Face) ---
|
|
@@ -93,13 +94,11 @@ def init():
|
|
| 93 |
pipe_.scheduler = DPMSolverMultistepScheduler.from_config(pipe_.scheduler.config)
|
| 94 |
|
| 95 |
# 6-4 IP-Adapter
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
### 最終修正 ### subfolder引数に空文字列""を渡し、TypeErrorを回避する
|
| 99 |
pipe_.load_ip_adapter(IP_REPO, "", weight_name=IP_BIN, cache_dir=str(MODELS))
|
| 100 |
|
| 101 |
AttnProcsLayers(pipe_.unet.attn_processors).load_lora_weights(
|
| 102 |
-
|
| 103 |
)
|
| 104 |
pipe_.set_adapters(["ip_faceid"], adapter_weights=[0.6])
|
| 105 |
pipe_.to("cuda"); pipe_ = pipe_
|
|
|
|
| 44 |
BRA_REV = "801a9b1999dd7018e58a1e2b432fdccd3d1d723d" # 固定 revision
|
| 45 |
|
| 46 |
# --- IP-Adapter 本体 & LoRA ---
|
| 47 |
+
### 根本修正 ### IP-Adapterの本体と画像エンコーダーを含む正しいリポジトリを指定
|
| 48 |
+
IP_REPO, IP_BIN = "h94/IP-Adapter-FaceID", "models/ip-adapter-plus-face_sd15.bin"
|
| 49 |
LORA_REPO,IP_LORA = "h94/IP-Adapter-FaceID", "ip-adapter-faceid-plusv2_sd15_lora.safetensors"
|
| 50 |
|
| 51 |
# --- ControlNet (MediaPipe Face) ---
|
|
|
|
| 94 |
pipe_.scheduler = DPMSolverMultistepScheduler.from_config(pipe_.scheduler.config)
|
| 95 |
|
| 96 |
# 6-4 IP-Adapter
|
| 97 |
+
# LoRAも同じリポジトリにあるため、個別のdlは不要
|
|
|
|
|
|
|
| 98 |
pipe_.load_ip_adapter(IP_REPO, "", weight_name=IP_BIN, cache_dir=str(MODELS))
|
| 99 |
|
| 100 |
AttnProcsLayers(pipe_.unet.attn_processors).load_lora_weights(
|
| 101 |
+
IP_REPO, weight_name=IP_LORA, adapter_name="ip_faceid", safe_load=True, cache_dir=str(MODELS)
|
| 102 |
)
|
| 103 |
pipe_.set_adapters(["ip_faceid"], adapter_weights=[0.6])
|
| 104 |
pipe_.to("cuda"); pipe_ = pipe_
|