Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,12 +28,12 @@ login(HF_TOKEN)
|
|
| 28 |
# model_id = 'RunDiffusion/Juggernaut-XL-v9'
|
| 29 |
# model_id = 'SG161222/RealVisXL_V5.0'
|
| 30 |
# model_id = 'Lykon/dreamshaper-xl-lightning'
|
| 31 |
-
|
| 32 |
-
model_file = "https://huggingface.co/RunDiffusion/Juggernaut-XI-v11/blob/main/Juggernaut-XI-byRunDiffusion.safetensors"
|
| 33 |
-
model_id = 'RunDiffusion/Juggernaut-XI-v11'
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
#model_file = hf_hub_download(repo_id=model_id, filename="Juggernaut-XI-byRunDiffusion.safetensors", repo_type="model")
|
| 38 |
|
| 39 |
face_detector = FaceAnalysis2(providers=['CPUExecutionProvider', 'CUDAExecutionProvider'], allowed_modules=['detection', 'recognition'])
|
|
@@ -71,21 +71,21 @@ adapter = T2IAdapter.from_pretrained(
|
|
| 71 |
"TencentARC/t2i-adapter-sketch-sdxl-1.0", torch_dtype=torch_dtype, variant="fp16"
|
| 72 |
).to(device)
|
| 73 |
|
| 74 |
-
pipe = PhotoMakerStableDiffusionXLAdapterPipeline.from_single_file(
|
| 75 |
-
|
| 76 |
-
adapter=adapter,
|
| 77 |
-
torch_dtype=torch.float16,
|
| 78 |
-
use_safetensors=True
|
| 79 |
-
).to(device)
|
| 80 |
-
|
| 81 |
-
# pipe = PhotoMakerStableDiffusionXLAdapterPipeline.from_pretrained(
|
| 82 |
-
# base_model_path,
|
| 83 |
# adapter=adapter,
|
| 84 |
-
# torch_dtype=
|
| 85 |
-
# use_safetensors=True
|
| 86 |
-
# variant="fp16",
|
| 87 |
# ).to(device)
|
| 88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
pipe.unet = pipe.unet.to(device=device, dtype=torch_dtype)
|
| 90 |
pipe.unet.to(memory_format=torch.channels_last)
|
| 91 |
pipe.unet.eval()
|
|
|
|
| 28 |
# model_id = 'RunDiffusion/Juggernaut-XL-v9'
|
| 29 |
# model_id = 'SG161222/RealVisXL_V5.0'
|
| 30 |
# model_id = 'Lykon/dreamshaper-xl-lightning'
|
| 31 |
+
model_id = 'SG161222/RealVisXL_V5.0_Lightning'
|
| 32 |
+
# model_file = "https://huggingface.co/RunDiffusion/Juggernaut-XI-v11/blob/main/Juggernaut-XI-byRunDiffusion.safetensors"
|
| 33 |
+
# model_id = 'RunDiffusion/Juggernaut-XI-v11'
|
| 34 |
+
base_model_path = Path(model_id)
|
| 35 |
+
os.makedirs(base_model_path, exist_ok=True)
|
| 36 |
+
snapshot_download(repo_id=model_id, local_dir=base_model_path)
|
| 37 |
#model_file = hf_hub_download(repo_id=model_id, filename="Juggernaut-XI-byRunDiffusion.safetensors", repo_type="model")
|
| 38 |
|
| 39 |
face_detector = FaceAnalysis2(providers=['CPUExecutionProvider', 'CUDAExecutionProvider'], allowed_modules=['detection', 'recognition'])
|
|
|
|
| 71 |
"TencentARC/t2i-adapter-sketch-sdxl-1.0", torch_dtype=torch_dtype, variant="fp16"
|
| 72 |
).to(device)
|
| 73 |
|
| 74 |
+
# pipe = PhotoMakerStableDiffusionXLAdapterPipeline.from_single_file(
|
| 75 |
+
# model_file,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
# adapter=adapter,
|
| 77 |
+
# torch_dtype=torch.float16,
|
| 78 |
+
# use_safetensors=True
|
|
|
|
| 79 |
# ).to(device)
|
| 80 |
|
| 81 |
+
pipe = PhotoMakerStableDiffusionXLAdapterPipeline.from_pretrained(
|
| 82 |
+
base_model_path,
|
| 83 |
+
adapter=adapter,
|
| 84 |
+
torch_dtype=torch_dtype,
|
| 85 |
+
use_safetensors=True,
|
| 86 |
+
variant="fp16",
|
| 87 |
+
).to(device)
|
| 88 |
+
|
| 89 |
pipe.unet = pipe.unet.to(device=device, dtype=torch_dtype)
|
| 90 |
pipe.unet.to(memory_format=torch.channels_last)
|
| 91 |
pipe.unet.eval()
|