user-agent commited on
Commit
e5a6ab0
·
verified ·
1 Parent(s): a50f12e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -54,12 +54,16 @@ import numpy as np
54
  # ).to("cuda")
55
 
56
  # 1) Load the SD3.5-Large T2I pipeline (will pull in its own VAE, UNet, text encoders, etc.)
 
 
 
 
57
  t2i = StableDiffusion3Pipeline.from_pretrained(
58
  "stabilityai/stable-diffusion-3.5-large",
59
- torch_dtype=torch.bfloat16, # recommended for SD3.5 [oai_citation:0‡github.com](https://github.com/huggingface/diffusers/releases?utm_source=chatgpt.com)
 
60
  ).to("cuda")
61
 
62
- # 2) Wrap it into the standard inpainting pipeline
63
  pipe = StableDiffusionInpaintPipeline(
64
  vae=t2i.vae,
65
  text_encoder=t2i.text_encoder,
@@ -68,10 +72,10 @@ pipe = StableDiffusionInpaintPipeline(
68
  scheduler=t2i.scheduler,
69
  safety_checker=t2i.safety_checker,
70
  feature_extractor=t2i.feature_extractor,
 
71
  ).to("cuda")
72
 
73
 
74
-
75
  # pipe.scheduler = TCDScheduler.from_config(pipe.scheduler.config)
76
  pipe.scheduler = TCDScheduler.from_config(pipe.scheduler.config)
77
 
 
54
  # ).to("cuda")
55
 
56
  # 1) Load the SD3.5-Large T2I pipeline (will pull in its own VAE, UNet, text encoders, etc.)
57
+ import os
58
+
59
+ HF_TOKEN = os.environ["HF_TOKEN"] # or os.getenv("HF_TOKEN")
60
+
61
  t2i = StableDiffusion3Pipeline.from_pretrained(
62
  "stabilityai/stable-diffusion-3.5-large",
63
+ torch_dtype=torch.bfloat16,
64
+ use_auth_token=HF_TOKEN # ← here
65
  ).to("cuda")
66
 
 
67
  pipe = StableDiffusionInpaintPipeline(
68
  vae=t2i.vae,
69
  text_encoder=t2i.text_encoder,
 
72
  scheduler=t2i.scheduler,
73
  safety_checker=t2i.safety_checker,
74
  feature_extractor=t2i.feature_extractor,
75
+ use_auth_token=HF_TOKEN # ← and here
76
  ).to("cuda")
77
 
78
 
 
79
  # pipe.scheduler = TCDScheduler.from_config(pipe.scheduler.config)
80
  pipe.scheduler = TCDScheduler.from_config(pipe.scheduler.config)
81