Spaces:
Running
on
Zero
Running
on
Zero
tori29umai
commited on
Commit
•
e09cb69
1
Parent(s):
ed2c803
app.py
Browse files- app.py +3 -7
- utils/dl_utils.py +1 -1
app.py
CHANGED
@@ -22,8 +22,8 @@ os.makedirs(cn_dir, exist_ok=True)
|
|
22 |
os.makedirs(tagger_dir, exist_ok=True)
|
23 |
os.makedirs(lora_dir, exist_ok=True)
|
24 |
|
25 |
-
|
26 |
-
|
27 |
dl_tagger_model(tagger_dir)
|
28 |
dl_lora_model(lora_dir)
|
29 |
|
@@ -31,11 +31,7 @@ def load_model(lora_dir, cn_dir):
|
|
31 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
32 |
dtype = torch.float16
|
33 |
vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
|
34 |
-
|
35 |
-
controlnet = ControlNetModel.from_pretrained(
|
36 |
-
"diffusers/controlnet-canny-sdxl-1.0",
|
37 |
-
torch_dtype=torch.float16
|
38 |
-
)
|
39 |
pipe = StableDiffusionXLControlNetImg2ImgPipeline.from_pretrained(
|
40 |
"cagliostrolab/animagine-xl-3.1", controlnet=controlnet, vae=vae, torch_dtype=torch.float16
|
41 |
)
|
|
|
22 |
os.makedirs(tagger_dir, exist_ok=True)
|
23 |
os.makedirs(lora_dir, exist_ok=True)
|
24 |
|
25 |
+
dl_cn_model(cn_dir)
|
26 |
+
dl_cn_config(cn_dir)
|
27 |
dl_tagger_model(tagger_dir)
|
28 |
dl_lora_model(lora_dir)
|
29 |
|
|
|
31 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
32 |
dtype = torch.float16
|
33 |
vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
|
34 |
+
controlnet = ControlNetModel.from_pretrained(cn_dir, torch_dtype=dtype, use_safetensors=True)
|
|
|
|
|
|
|
|
|
35 |
pipe = StableDiffusionXLControlNetImg2ImgPipeline.from_pretrained(
|
36 |
"cagliostrolab/animagine-xl-3.1", controlnet=controlnet, vae=vae, torch_dtype=torch.float16
|
37 |
)
|
utils/dl_utils.py
CHANGED
@@ -11,7 +11,7 @@ import cv2
|
|
11 |
def dl_cn_model(model_dir):
|
12 |
folder = model_dir
|
13 |
file_name = 'diffusion_pytorch_model.safetensors'
|
14 |
-
url = "
|
15 |
file_path = os.path.join(folder, file_name)
|
16 |
if not os.path.exists(file_path):
|
17 |
response = requests.get(url, allow_redirects=True)
|
|
|
11 |
def dl_cn_model(model_dir):
|
12 |
folder = model_dir
|
13 |
file_name = 'diffusion_pytorch_model.safetensors'
|
14 |
+
url = "https://huggingface.co/kataragi/controlnet_canny/resolve/main/Kataragi_cannyXL-fp16.safetensors"
|
15 |
file_path = os.path.join(folder, file_name)
|
16 |
if not os.path.exists(file_path):
|
17 |
response = requests.get(url, allow_redirects=True)
|