Spaces:
Running
on
Zero
Running
on
Zero
Commit
•
b93d27c
1
Parent(s):
e8e959c
Update app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,7 @@ from diffusers import AutoencoderKL, EulerDiscreteScheduler
|
|
15 |
from huggingface_hub import snapshot_download
|
16 |
import spaces
|
17 |
|
18 |
-
device = "cuda"
|
19 |
root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
20 |
ckpt_dir = f'{root_dir}/weights/Kolors'
|
21 |
|
@@ -35,7 +35,7 @@ image_encoder = CLIPVisionModelWithProjection.from_pretrained(
|
|
35 |
).to(dtype=torch.float16, device=device)
|
36 |
|
37 |
ip_img_size = 336
|
38 |
-
clip_image_processor = CLIPImageProcessor(size=ip_img_size, crop_size=ip_img_size)
|
39 |
|
40 |
pipe = StableDiffusionXLPipeline(
|
41 |
vae=vae,
|
@@ -46,9 +46,9 @@ pipe = StableDiffusionXLPipeline(
|
|
46 |
image_encoder=image_encoder,
|
47 |
feature_extractor=clip_image_processor,
|
48 |
force_zeros_for_empty_prompt=False
|
49 |
-
)
|
50 |
|
51 |
-
pipe = pipe.to(device)
|
52 |
#pipe.enable_model_cpu_offload()
|
53 |
|
54 |
if hasattr(pipe.unet, 'encoder_hid_proj'):
|
|
|
15 |
from huggingface_hub import snapshot_download
|
16 |
import spaces
|
17 |
|
18 |
+
device = "cuda"
|
19 |
root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
20 |
ckpt_dir = f'{root_dir}/weights/Kolors'
|
21 |
|
|
|
35 |
).to(dtype=torch.float16, device=device)
|
36 |
|
37 |
ip_img_size = 336
|
38 |
+
clip_image_processor = CLIPImageProcessor(size=ip_img_size, crop_size=ip_img_size).to(device)
|
39 |
|
40 |
pipe = StableDiffusionXLPipeline(
|
41 |
vae=vae,
|
|
|
46 |
image_encoder=image_encoder,
|
47 |
feature_extractor=clip_image_processor,
|
48 |
force_zeros_for_empty_prompt=False
|
49 |
+
).to(device)
|
50 |
|
51 |
+
#pipe = pipe.to(device)
|
52 |
#pipe.enable_model_cpu_offload()
|
53 |
|
54 |
if hasattr(pipe.unet, 'encoder_hid_proj'):
|