Update src/pipeline.py
Browse files- src/pipeline.py +3 -2
src/pipeline.py
CHANGED
|
@@ -37,6 +37,7 @@ class SDXLQuantization:
|
|
| 37 |
|
| 38 |
Pipeline = None
|
| 39 |
MODEL_ID = "black-forest-labs/FLUX.1-schnell"
|
|
|
|
| 40 |
def clear():
|
| 41 |
gc.collect()
|
| 42 |
torch.cuda.empty_cache()
|
|
@@ -47,12 +48,12 @@ def load_pipeline() -> Pipeline:
|
|
| 47 |
clear()
|
| 48 |
dtype, device = torch.bfloat16, "cuda"
|
| 49 |
vae = AutoencoderKL.from_pretrained(
|
| 50 |
-
MODEL_ID, subfolder="vae", torch_dtype=
|
| 51 |
)
|
| 52 |
instance = SDXLQuantization(vae, 8)
|
| 53 |
instance.quantize_model()
|
| 54 |
|
| 55 |
-
pipeline = FluxPipeline.from_pretrained(
|
| 56 |
torch_dtype=DTYPE)
|
| 57 |
pipeline.text_encoder.to(memory_format=torch.channels_last)
|
| 58 |
pipeline.text_encoder_2.to(memory_format=torch.channels_last)
|
|
|
|
| 37 |
|
| 38 |
Pipeline = None
|
| 39 |
MODEL_ID = "black-forest-labs/FLUX.1-schnell"
|
| 40 |
+
DTYPE = torch.bfloat16
|
| 41 |
def clear():
|
| 42 |
gc.collect()
|
| 43 |
torch.cuda.empty_cache()
|
|
|
|
| 48 |
clear()
|
| 49 |
dtype, device = torch.bfloat16, "cuda"
|
| 50 |
vae = AutoencoderKL.from_pretrained(
|
| 51 |
+
MODEL_ID, subfolder="vae", torch_dtype=DTYPE
|
| 52 |
)
|
| 53 |
instance = SDXLQuantization(vae, 8)
|
| 54 |
instance.quantize_model()
|
| 55 |
|
| 56 |
+
pipeline = FluxPipeline.from_pretrained(MODEL_ID,vae=vae,
|
| 57 |
torch_dtype=DTYPE)
|
| 58 |
pipeline.text_encoder.to(memory_format=torch.channels_last)
|
| 59 |
pipeline.text_encoder_2.to(memory_format=torch.channels_last)
|