Update src/pipeline.py
Browse files- src/pipeline.py +2 -5
src/pipeline.py
CHANGED
|
@@ -9,7 +9,6 @@ from transformers import T5EncoderModel, T5TokenizerFast, CLIPTokenizer, CLIPTex
|
|
| 9 |
import diffusers
|
| 10 |
import gc
|
| 11 |
from diffusers import FluxTransformer2DModel, DiffusionPipeline
|
| 12 |
-
from optimum.quanto import freeze, qfloat8, quantize
|
| 13 |
|
| 14 |
torch.set_float32_matmul_precision("high")
|
| 15 |
|
|
@@ -32,13 +31,11 @@ def fart():
|
|
| 32 |
|
| 33 |
def load_pipeline() -> Pipeline:
|
| 34 |
fart()
|
| 35 |
-
|
| 36 |
-
quantize(transformer, weights=qfloat8)
|
| 37 |
-
freeze(transformer)
|
| 38 |
pipeline = DiffusionPipeline.from_pretrained(ckpt_id, torch_dtype=torch.bfloat16)
|
| 39 |
-
pipeline.transformer = transformer
|
| 40 |
pipeline.vae = torch.compile(pipeline.vae, mode="max-autotune", fullgraph=False)
|
| 41 |
pipeline.enable_sequential_cpu_offload()
|
|
|
|
| 42 |
for _ in range(2):
|
| 43 |
pipeline(prompt="insensible, timbale, pothery, electrovital, actinogram, taxis, intracerebellar, centrodesmus", width=1024, height=1024, guidance_scale=0.0, num_inference_steps=4, max_sequence_length=256)
|
| 44 |
fart()
|
|
|
|
| 9 |
import diffusers
|
| 10 |
import gc
|
| 11 |
from diffusers import FluxTransformer2DModel, DiffusionPipeline
|
|
|
|
| 12 |
|
| 13 |
torch.set_float32_matmul_precision("high")
|
| 14 |
|
|
|
|
| 31 |
|
| 32 |
def load_pipeline() -> Pipeline:
|
| 33 |
fart()
|
| 34 |
+
|
|
|
|
|
|
|
| 35 |
pipeline = DiffusionPipeline.from_pretrained(ckpt_id, torch_dtype=torch.bfloat16)
|
|
|
|
| 36 |
pipeline.vae = torch.compile(pipeline.vae, mode="max-autotune", fullgraph=False)
|
| 37 |
pipeline.enable_sequential_cpu_offload()
|
| 38 |
+
|
| 39 |
for _ in range(2):
|
| 40 |
pipeline(prompt="insensible, timbale, pothery, electrovital, actinogram, taxis, intracerebellar, centrodesmus", width=1024, height=1024, guidance_scale=0.0, num_inference_steps=4, max_sequence_length=256)
|
| 41 |
fart()
|