Update Garage/models/PowerPaintModel.py
Browse files
Garage/models/PowerPaintModel.py
CHANGED
@@ -10,6 +10,7 @@ from .PowerPaint.utils import TokenizerWrapper, add_tokens
|
|
10 |
from safetensors.torch import load_model
|
11 |
from typing import Dict
|
12 |
from PIL import Image
|
|
|
13 |
|
14 |
class PowerPaintModel:
|
15 |
def __init__(self,
|
@@ -83,14 +84,18 @@ class PowerPaintModel:
|
|
83 |
initialize_tokens=["a", "a", "a"],
|
84 |
num_vectors_per_token=10
|
85 |
)
|
86 |
-
|
|
|
|
|
|
|
|
|
87 |
load_model(
|
88 |
pipe.brushnet,
|
89 |
-
|
90 |
)
|
91 |
|
92 |
pipe.text_encoder_brushnet.load_state_dict(
|
93 |
-
torch.load(
|
94 |
)
|
95 |
|
96 |
pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
|
|
|
10 |
from safetensors.torch import load_model
|
11 |
from typing import Dict
|
12 |
from PIL import Image
|
13 |
+
from huggingface_hub import hf_hub_download
|
14 |
|
15 |
class PowerPaintModel:
|
16 |
def __init__(self,
|
|
|
84 |
initialize_tokens=["a", "a", "a"],
|
85 |
num_vectors_per_token=10
|
86 |
)
|
87 |
+
|
88 |
+
brushnet_weights_path = hf_hub_download(repo_id="anvilarth/PP_Brushnet", filename="diffusion_pytorch_model.safetensors")
|
89 |
+
brushnet_encoder_path = hf_hub_download(repo_id="anvilarth/PP_Brushnet", filename="pytorch_model.bin")
|
90 |
+
|
91 |
+
|
92 |
load_model(
|
93 |
pipe.brushnet,
|
94 |
+
brushnet_weights_path
|
95 |
)
|
96 |
|
97 |
pipe.text_encoder_brushnet.load_state_dict(
|
98 |
+
torch.load(brushnet_encoder_path), strict=False
|
99 |
)
|
100 |
|
101 |
pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
|