Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -60,22 +60,26 @@ def generate(
|
|
60 |
|
61 |
if not use_img2img:
|
62 |
pipe = DiffusionPipeline.from_pretrained(model, torch_dtype=torch.float16)
|
63 |
-
|
|
|
64 |
|
65 |
if use_vae:
|
66 |
vae = AutoencoderKL.from_pretrained(vaecall, torch_dtype=torch.float16)
|
67 |
pipe = DiffusionPipeline.from_pretrained(model, vae=vae, torch_dtype=torch.float16)
|
68 |
-
pipe.
|
|
|
69 |
|
70 |
if use_img2img:
|
71 |
pipe = AutoPipelineForImage2Image.from_pretrained(model, torch_dtype=torch.float16)
|
72 |
-
pipe.
|
|
|
73 |
|
74 |
if use_vae:
|
75 |
vae = AutoencoderKL.from_pretrained(vaecall, torch_dtype=torch.float16)
|
76 |
pipe = AutoPipelineForImage2Image.from_pretrained(model, vae=vae, torch_dtype=torch.float16)
|
77 |
-
pipe.
|
78 |
-
|
|
|
79 |
response = requests.get(url)
|
80 |
init_image = Image.open(BytesIO(response.content)).convert("RGB")
|
81 |
init_image = init_image.resize((width, height))
|
|
|
60 |
|
61 |
if not use_img2img:
|
62 |
pipe = DiffusionPipeline.from_pretrained(model, torch_dtype=torch.float16)
|
63 |
+
pipe.enable_model_cpu_offload()
|
64 |
+
pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
|
65 |
|
66 |
if use_vae:
|
67 |
vae = AutoencoderKL.from_pretrained(vaecall, torch_dtype=torch.float16)
|
68 |
pipe = DiffusionPipeline.from_pretrained(model, vae=vae, torch_dtype=torch.float16)
|
69 |
+
pipe.enable_model_cpu_offload()
|
70 |
+
pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
|
71 |
|
72 |
if use_img2img:
|
73 |
pipe = AutoPipelineForImage2Image.from_pretrained(model, torch_dtype=torch.float16)
|
74 |
+
pipe.enable_model_cpu_offload()
|
75 |
+
pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
|
76 |
|
77 |
if use_vae:
|
78 |
vae = AutoencoderKL.from_pretrained(vaecall, torch_dtype=torch.float16)
|
79 |
pipe = AutoPipelineForImage2Image.from_pretrained(model, vae=vae, torch_dtype=torch.float16)
|
80 |
+
pipe.enable_model_cpu_offload()
|
81 |
+
pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
|
82 |
+
|
83 |
response = requests.get(url)
|
84 |
init_image = Image.open(BytesIO(response.content)).convert("RGB")
|
85 |
init_image = init_image.resize((width, height))
|