Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -78,19 +78,22 @@ def upload_to_gcs(image_object, filename):
|
|
| 78 |
|
| 79 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
| 80 |
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
|
| 88 |
-
|
| 89 |
-
pipe.transformer=ll_transformer
|
| 90 |
-
pipe.load_lora_weights("ford442/sdxl-vae-bf16", weight_name="LoRA/UltraReal.safetensors")
|
| 91 |
-
pipe.to(device=device, dtype=torch.bfloat16)
|
| 92 |
-
|
| 93 |
-
upscaler_2 = UpscaleWithModel.from_pretrained("Kim2091/ClearRealityV1").to(device)
|
| 94 |
|
| 95 |
MAX_SEED = np.iinfo(np.int32).max
|
| 96 |
MAX_IMAGE_SIZE = 4096
|
|
|
|
| 78 |
|
| 79 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
| 80 |
|
| 81 |
+
@spaces.on_start
|
| 82 |
+
def load_model():
|
| 83 |
+
pipe = StableDiffusion3Pipeline.from_pretrained(
|
| 84 |
+
"ford442/stable-diffusion-3.5-large-bf16",
|
| 85 |
+
trust_remote_code=True,
|
| 86 |
+
transformer=None, # Load transformer separately
|
| 87 |
+
use_safetensors=True
|
| 88 |
+
)
|
| 89 |
+
ll_transformer=SD3Transformer2DModel.from_pretrained("ford442/stable-diffusion-3.5-large-bf16", subfolder='transformer').to(device, dtype=torch.bfloat16)
|
| 90 |
+
pipe.transformer=ll_transformer
|
| 91 |
+
pipe.load_lora_weights("ford442/sdxl-vae-bf16", weight_name="LoRA/UltraReal.safetensors")
|
| 92 |
+
pipe.to(device=device, dtype=torch.bfloat16)
|
| 93 |
+
upscaler_2 = UpscaleWithModel.from_pretrained("Kim2091/ClearRealityV1").to(device)
|
| 94 |
+
return pipe, upscaler_2
|
| 95 |
|
| 96 |
+
pipe, upscaler_2 = load_model()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
|
| 98 |
MAX_SEED = np.iinfo(np.int32).max
|
| 99 |
MAX_IMAGE_SIZE = 4096
|