Allow `safety_checker` to be `None` when using CPU offload (#1078)
Allow None safety_checker when using CPU offload.
This commit is contained in:
parent
e4d264e4eb
commit
bf7b0bc25b
|
@ -133,7 +133,8 @@ class StableDiffusionPipeline(DiffusionPipeline):
|
||||||
device = torch.device("cuda")
|
device = torch.device("cuda")
|
||||||
|
|
||||||
for cpu_offloaded_model in [self.unet, self.text_encoder, self.vae, self.safety_checker]:
|
for cpu_offloaded_model in [self.unet, self.text_encoder, self.vae, self.safety_checker]:
|
||||||
cpu_offload(cpu_offloaded_model, device)
|
if cpu_offloaded_model is not None:
|
||||||
|
cpu_offload(cpu_offloaded_model, device)
|
||||||
|
|
||||||
@torch.no_grad()
|
@torch.no_grad()
|
||||||
def __call__(
|
def __call__(
|
||||||
|
|
Loading…
Reference in New Issue