pdbdb commited on
Commit
6dd88e5
Β·
1 Parent(s): c0db44e

from_pretrained instead of from_single_file

Browse files
Files changed (1) hide show
  1. app.py +19 -9
app.py CHANGED
@@ -4,20 +4,30 @@ from diffusers import StableDiffusionXLPipeline
4
 
5
  # Hub IDs of the weights you just pushed
6
  BASE_MODEL_REPO = "SG161222/RealVisXL_V5.0/RealVisXL_V5.0_fp16.safetensors" # or a public ID
7
- BASE_URL = (
8
- "https://huggingface.co/SG161222/RealVisXL_V5.0/"
9
- "resolve/main/RealVisXL_V5.0_fp16.safetensors"
10
- )
11
  LORA_REPO = "pdbdb/lora-act"
12
 
13
  print("⏳ Loading SDXL base …")
14
- pipe = StableDiffusionXLPipeline.from_single_file(
15
- BASE_URL,
16
- torch_dtype=torch.float16,
17
- variant="fp16",
18
- add_watermarker=False,
 
 
 
 
 
 
 
 
 
19
  ).to("cuda")
20
 
 
21
  # ── collect LoRAs from the Hub snapshot ──────────────────────────
22
  snapshot_path = Path(
23
  torch.hub.download_url_to_file( # one-liner cache download
 
4
 
5
  # Hub IDs of the weights you just pushed
6
  BASE_MODEL_REPO = "SG161222/RealVisXL_V5.0/RealVisXL_V5.0_fp16.safetensors" # or a public ID
7
+ # BASE_URL = (
8
+ # "https://huggingface.co/SG161222/RealVisXL_V5.0/"
9
+ # "resolve/main/RealVisXL_V5.0_fp16.safetensors"
10
+ # )
11
  LORA_REPO = "pdbdb/lora-act"
12
 
13
  print("⏳ Loading SDXL base …")
14
+ # pipe = StableDiffusionXLPipeline.from_single_file(
15
+ # BASE_MODEL_REPO,
16
+ # torch_dtype=torch.float16,
17
+ # variant="fp16",
18
+ # add_watermarker=False,
19
+ # ).to("cuda")
20
+
21
+ pipe = StableDiffusionXLPipeline.from_pretrained(
22
+ "SG161222/RealVisXL_V5.0",
23
+ torch_dtype=torch.float16,
24
+ variant="fp16", # picks the *_fp16.safetensors under the hood
25
+ use_safetensors=True, # make sure to load safetensors
26
+ safe_serialization=True,
27
+ add_watermarker=False,
28
  ).to("cuda")
29
 
30
+
31
  # ── collect LoRAs from the Hub snapshot ──────────────────────────
32
  snapshot_path = Path(
33
  torch.hub.download_url_to_file( # one-liner cache download