Update handler.py
Browse files- handler.py +3 -3
handler.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
# https://github.com/sayakpaul/diffusers-torchao
|
| 2 |
-
#
|
| 3 |
import os
|
| 4 |
from typing import Any, Dict
|
| 5 |
from PIL import Image
|
|
@@ -18,8 +18,8 @@ class EndpointHandler:
|
|
| 18 |
torch_dtype=torch.bfloat16,
|
| 19 |
).to("cuda")
|
| 20 |
apply_cache_on_pipe(self.pipe, residual_diff_threshold=0.12)
|
| 21 |
-
|
| 22 |
-
|
| 23 |
self.pipe.transformer = torch.compile(
|
| 24 |
self.pipe.transformer, mode="max-autotune-no-cudagraphs",
|
| 25 |
)
|
|
|
|
| 1 |
# https://github.com/sayakpaul/diffusers-torchao
|
| 2 |
+
#6.22s
|
| 3 |
import os
|
| 4 |
from typing import Any, Dict
|
| 5 |
from PIL import Image
|
|
|
|
| 18 |
torch_dtype=torch.bfloat16,
|
| 19 |
).to("cuda")
|
| 20 |
apply_cache_on_pipe(self.pipe, residual_diff_threshold=0.12)
|
| 21 |
+
quantize_(self.pipe.text_encoder, float8_weight_only())
|
| 22 |
+
quantize_(self.pipe.transformer, float8_dynamic_activation_float8_weight())
|
| 23 |
self.pipe.transformer = torch.compile(
|
| 24 |
self.pipe.transformer, mode="max-autotune-no-cudagraphs",
|
| 25 |
)
|