quantize
Browse files- src/pipeline.py +9 -3
src/pipeline.py
CHANGED
@@ -14,6 +14,12 @@ from transformers import T5EncoderModel, CLIPTextModel
|
|
14 |
|
15 |
Pipeline: TypeAlias = FluxPipeline
|
16 |
torch.backends.cudnn.benchmark = True
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
CHECKPOINT = "jokerbit/flux.1-schnell-Robert-int8wo"
|
19 |
REVISION = "5ef0012f11a863e5111ec56540302a023bc8587b"
|
@@ -28,7 +34,7 @@ def load_pipeline() -> Pipeline:
|
|
28 |
path,
|
29 |
use_safetensors=False,
|
30 |
local_files_only=True,
|
31 |
-
torch_dtype=torch.bfloat16)
|
32 |
vae = AutoencoderTiny.from_pretrained(
|
33 |
TinyVAE,
|
34 |
revision=TinyVAE_REV,
|
@@ -44,9 +50,9 @@ def load_pipeline() -> Pipeline:
|
|
44 |
torch_dtype=torch.bfloat16,
|
45 |
)
|
46 |
|
47 |
-
pipeline.to(memory_format=torch.channels_last)
|
48 |
pipeline.to("cuda")
|
49 |
-
|
50 |
for _ in range(4):
|
51 |
pipeline("cat", num_inference_steps=4)
|
52 |
|
|
|
14 |
|
15 |
Pipeline: TypeAlias = FluxPipeline
|
16 |
torch.backends.cudnn.benchmark = True
|
17 |
+
torch.backends.cudnn.benchmark = True
|
18 |
+
torch._inductor.config.conv_1x1_as_mm = True
|
19 |
+
torch._inductor.config.coordinate_descent_tuning = True
|
20 |
+
torch._inductor.config.epilogue_fusion = False
|
21 |
+
torch._inductor.config.coordinate_descent_check_all_directions = True
|
22 |
+
os.environ['PYTORCH_CUDA_ALLOC_CONF']="expandable_segments:True"
|
23 |
|
24 |
CHECKPOINT = "jokerbit/flux.1-schnell-Robert-int8wo"
|
25 |
REVISION = "5ef0012f11a863e5111ec56540302a023bc8587b"
|
|
|
34 |
path,
|
35 |
use_safetensors=False,
|
36 |
local_files_only=True,
|
37 |
+
torch_dtype=torch.bfloat16)
|
38 |
vae = AutoencoderTiny.from_pretrained(
|
39 |
TinyVAE,
|
40 |
revision=TinyVAE_REV,
|
|
|
50 |
torch_dtype=torch.bfloat16,
|
51 |
)
|
52 |
|
53 |
+
pipeline.transformer.to(memory_format=torch.channels_last)
|
54 |
pipeline.to("cuda")
|
55 |
+
quantize_(pipeline.vae, int8_weight_only())
|
56 |
for _ in range(4):
|
57 |
pipeline("cat", num_inference_steps=4)
|
58 |
|