Spaces:
Running
Running
Sean Powell commited on
Commit ·
710f85d
1
Parent(s): a30feef
Attempt to cast bias to f16.
Browse files- utils/pipes.py +0 -2
- utils/tiling.py +4 -0
utils/pipes.py
CHANGED
|
@@ -9,7 +9,6 @@ def create_stable_diffusion_xl_pipeline(device):
|
|
| 9 |
"stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, variant="fp16", use_safetensors=True
|
| 10 |
)
|
| 11 |
pipe = pipe.to(device)
|
| 12 |
-
pipe.vae.disable_vae_slicing() # Experimental
|
| 13 |
pipe.vae.disable_tiling()
|
| 14 |
tiling.enable_circular_tiling([pipe.vae, pipe.text_encoder, pipe.unet])
|
| 15 |
return pipe
|
|
@@ -20,7 +19,6 @@ def create_stable_diffusion_xl_img2img_pipe(device):
|
|
| 20 |
"stabilityai/stable-diffusion-xl-refiner-1.0", torch_dtype=torch.float16, variant="fp16", use_safetensors=True
|
| 21 |
)
|
| 22 |
pipe = pipe.to(device)
|
| 23 |
-
pipe.vae.disable_vae_slicing() # Experimental
|
| 24 |
pipe.vae.disable_tiling()
|
| 25 |
tiling.enable_circular_tiling([pipe.vae, pipe.text_encoder_2, pipe.unet])
|
| 26 |
return pipe
|
|
|
|
| 9 |
"stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, variant="fp16", use_safetensors=True
|
| 10 |
)
|
| 11 |
pipe = pipe.to(device)
|
|
|
|
| 12 |
pipe.vae.disable_tiling()
|
| 13 |
tiling.enable_circular_tiling([pipe.vae, pipe.text_encoder, pipe.unet])
|
| 14 |
return pipe
|
|
|
|
| 19 |
"stabilityai/stable-diffusion-xl-refiner-1.0", torch_dtype=torch.float16, variant="fp16", use_safetensors=True
|
| 20 |
)
|
| 21 |
pipe = pipe.to(device)
|
|
|
|
| 22 |
pipe.vae.disable_tiling()
|
| 23 |
tiling.enable_circular_tiling([pipe.vae, pipe.text_encoder_2, pipe.unet])
|
| 24 |
return pipe
|
utils/tiling.py
CHANGED
|
@@ -29,6 +29,10 @@ def asymmetric_conv2d_conv_forward(self, input: Tensor, weight: Tensor, bias: Op
|
|
| 29 |
self.paddingY = (0, 0, self._reversed_padding_repeated_twice[2], self._reversed_padding_repeated_twice[3])
|
| 30 |
working = F.pad(input, self.paddingX, mode='circular')
|
| 31 |
working = F.pad(working, self.paddingY, mode='circular')
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
return F.conv2d(working, weight, bias, self.stride, _pair(0), self.dilation, self.groups)
|
| 33 |
|
| 34 |
|
|
|
|
| 29 |
self.paddingY = (0, 0, self._reversed_padding_repeated_twice[2], self._reversed_padding_repeated_twice[3])
|
| 30 |
working = F.pad(input, self.paddingX, mode='circular')
|
| 31 |
working = F.pad(working, self.paddingY, mode='circular')
|
| 32 |
+
|
| 33 |
+
if bias is not None:
|
| 34 |
+
bias = bias.to(input.dtype)
|
| 35 |
+
|
| 36 |
return F.conv2d(working, weight, bias, self.stride, _pair(0), self.dilation, self.groups)
|
| 37 |
|
| 38 |
|