Spaces:
Running
on
Zero
Running
on
Zero
add offload
Browse files
gradio_app/custom_models/mvimg_prediction.py
CHANGED
@@ -14,7 +14,7 @@ checkpoint_path = "ckpt/img2mvimg/unet_state_dict.pth"
|
|
14 |
|
15 |
def predict(img_list: List[Image.Image], guidance_scale=2., **kwargs):
|
16 |
trainer, pipeline = load_pipeline(training_config, checkpoint_path)
|
17 |
-
|
18 |
|
19 |
if isinstance(img_list, Image.Image):
|
20 |
img_list = [img_list]
|
|
|
14 |
|
15 |
def predict(img_list: List[Image.Image], guidance_scale=2., **kwargs):
|
16 |
trainer, pipeline = load_pipeline(training_config, checkpoint_path)
|
17 |
+
pipeline.enable_model_cpu_offload()
|
18 |
|
19 |
if isinstance(img_list, Image.Image):
|
20 |
img_list = [img_list]
|
gradio_app/custom_models/normal_prediction.py
CHANGED
@@ -10,7 +10,7 @@ checkpoint_path = "ckpt/image2normal/unet_state_dict.pth"
|
|
10 |
|
11 |
def predict_normals(image: List[Image.Image], guidance_scale=2., do_rotate=True, num_inference_steps=30, **kwargs):
|
12 |
trainer, pipeline = load_pipeline(training_config, checkpoint_path)
|
13 |
-
|
14 |
|
15 |
img_list = image if isinstance(image, list) else [image]
|
16 |
img_list = [rgba_to_rgb(i) if i.mode == 'RGBA' else i for i in img_list]
|
|
|
10 |
|
11 |
def predict_normals(image: List[Image.Image], guidance_scale=2., do_rotate=True, num_inference_steps=30, **kwargs):
|
12 |
trainer, pipeline = load_pipeline(training_config, checkpoint_path)
|
13 |
+
pipeline.enable_model_cpu_offload()
|
14 |
|
15 |
img_list = image if isinstance(image, list) else [image]
|
16 |
img_list = [rgba_to_rgb(i) if i.mode == 'RGBA' else i for i in img_list]
|
scripts/sd_model_zoo.py
CHANGED
@@ -119,9 +119,8 @@ def load_common_sd15_pipe(base_model=DEFAULT_BASE_MODEL, device="balanced", cont
|
|
119 |
if enable_sequential_cpu_offload:
|
120 |
pipe.enable_sequential_cpu_offload()
|
121 |
else:
|
122 |
-
# pipe = pipe.to("cuda")
|
123 |
pass
|
124 |
-
|
125 |
if vae_slicing:
|
126 |
pipe.enable_vae_slicing()
|
127 |
|
|
|
119 |
if enable_sequential_cpu_offload:
|
120 |
pipe.enable_sequential_cpu_offload()
|
121 |
else:
|
|
|
122 |
pass
|
123 |
+
pipe.enable_model_cpu_offload()
|
124 |
if vae_slicing:
|
125 |
pipe.enable_vae_slicing()
|
126 |
|