Skip to content

Commit 2c6bc0f

Browse files
small fix
1 parent 2902109 commit 2c6bc0f

8 files changed

+8
-7
lines changed

src/diffusers/pipelines/alt_diffusion/pipeline_alt_diffusion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ def enable_sequential_cpu_offload(self, gpu_id=0):
236236
if self.safety_checker is not None:
237237
# TODO(Patrick) - there is currently a bug with cpu offload of nn.Parameter in accelerate
238238
# fix by only offloading self.safety_checker for now
239-
cpu_offload(self.safety_checker.vision_model)
239+
cpu_offload(self.safety_checker.vision_model, device)
240240

241241
@property
242242
def _execution_device(self):

src/diffusers/pipelines/alt_diffusion/pipeline_alt_diffusion_img2img.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def enable_sequential_cpu_offload(self, gpu_id=0):
231231
if self.safety_checker is not None:
232232
# TODO(Patrick) - there is currently a bug with cpu offload of nn.Parameter in accelerate
233233
# fix by only offloading self.safety_checker for now
234-
cpu_offload(self.safety_checker.vision_model)
234+
cpu_offload(self.safety_checker.vision_model, device)
235235

236236
@property
237237
def _execution_device(self):

src/diffusers/pipelines/stable_diffusion/pipeline_cycle_diffusion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def enable_sequential_cpu_offload(self, gpu_id=0):
264264
if self.safety_checker is not None:
265265
# TODO(Patrick) - there is currently a bug with cpu offload of nn.Parameter in accelerate
266266
# fix by only offloading self.safety_checker for now
267-
cpu_offload(self.safety_checker.vision_model)
267+
cpu_offload(self.safety_checker.vision_model, device)
268268

269269
@property
270270
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline._execution_device

src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def enable_sequential_cpu_offload(self, gpu_id=0):
235235
if self.safety_checker is not None:
236236
# TODO(Patrick) - there is currently a bug with cpu offload of nn.Parameter in accelerate
237237
# fix by only offloading self.safety_checker for now
238-
cpu_offload(self.safety_checker.vision_model)
238+
cpu_offload(self.safety_checker.vision_model, device)
239239

240240
@property
241241
def _execution_device(self):

src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_img2img.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def enable_sequential_cpu_offload(self, gpu_id=0):
233233
if self.safety_checker is not None:
234234
# TODO(Patrick) - there is currently a bug with cpu offload of nn.Parameter in accelerate
235235
# fix by only offloading self.safety_checker for now
236-
cpu_offload(self.safety_checker.vision_model)
236+
cpu_offload(self.safety_checker.vision_model, device)
237237

238238
@property
239239
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline._execution_device

src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ def enable_sequential_cpu_offload(self, gpu_id=0):
298298
if self.safety_checker is not None:
299299
# TODO(Patrick) - there is currently a bug with cpu offload of nn.Parameter in accelerate
300300
# fix by only offloading self.safety_checker for now
301-
cpu_offload(self.safety_checker.vision_model)
301+
cpu_offload(self.safety_checker.vision_model, device)
302302

303303
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.enable_xformers_memory_efficient_attention
304304
def enable_xformers_memory_efficient_attention(self):

src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint_legacy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def enable_sequential_cpu_offload(self, gpu_id=0):
246246
if self.safety_checker is not None:
247247
# TODO(Patrick) - there is currently a bug with cpu offload of nn.Parameter in accelerate
248248
# fix by only offloading self.safety_checker for now
249-
cpu_offload(self.safety_checker.vision_model)
249+
cpu_offload(self.safety_checker.vision_model, device)
250250

251251
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.enable_xformers_memory_efficient_attention
252252
def enable_xformers_memory_efficient_attention(self):

tests/pipelines/versatile_diffusion/test_versatile_diffusion_image_variation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,6 @@ def test_inference_image_variations(self):
5454
image_slice = image[0, 253:256, 253:256, -1]
5555

5656
assert image.shape == (1, 512, 512, 3)
57+
print(torch.from_numpy(image_slice.flatten()))
5758
expected_slice = np.array([0.0113, 0.2241, 0.4024, 0.0839, 0.0871, 0.2725, 0.2581, 0.0, 0.1096])
5859
assert np.abs(image_slice.flatten() - expected_slice).max() < 1e-2

0 commit comments

Comments
 (0)