Commit
·
17fe0cc
1
Parent(s):
a9ef0f5
last test vae enabling
Browse files- handler.py +2 -10
handler.py
CHANGED
@@ -24,19 +24,11 @@ class EndpointHandler():
|
|
24 |
|
25 |
|
26 |
|
27 |
-
def patch_conv(cls):
|
28 |
-
init = cls.__init__
|
29 |
-
def __init__(self, *args, **kwargs):
|
30 |
-
return init(self, *args, **kwargs, padding_mode='circular')
|
31 |
-
cls.__init__ = __init__
|
32 |
-
|
33 |
-
patch_conv(torch.nn.Conv2d)
|
34 |
-
|
35 |
-
|
36 |
|
37 |
|
38 |
self.pipe = StableDiffusionPipeline.from_pretrained(self.stable_diffusion_id,torch_dtype=dtype,safety_checker=StableDiffusionSafetyChecker.from_pretrained("CompVis/stable-diffusion-safety-checker", torch_dtype=dtype)).to(device.type)
|
39 |
-
|
|
|
40 |
self.generator = torch.Generator(device=device.type).manual_seed(3)
|
41 |
|
42 |
def __call__(self, data: Any) -> List[List[Dict[str, float]]]:
|
|
|
24 |
|
25 |
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
|
29 |
self.pipe = StableDiffusionPipeline.from_pretrained(self.stable_diffusion_id,torch_dtype=dtype,safety_checker=StableDiffusionSafetyChecker.from_pretrained("CompVis/stable-diffusion-safety-checker", torch_dtype=dtype)).to(device.type)
|
30 |
+
self.pipe.enable_xformers_memory_efficient_attention()
|
31 |
+
self.pipe.enable_vae_tiling()
|
32 |
self.generator = torch.Generator(device=device.type).manual_seed(3)
|
33 |
|
34 |
def __call__(self, data: Any) -> List[List[Dict[str, float]]]:
|