Update src/pipeline.py
Browse files- src/pipeline.py +3 -4
src/pipeline.py
CHANGED
@@ -13,7 +13,7 @@ from diffusers import FluxTransformer2DModel, DiffusionPipeline
|
|
13 |
from torchao.quantization import quantize_, int8_weight_only, fpx_weight_only
|
14 |
|
15 |
os.environ['PYTORCH_CUDA_ALLOC_CONF']="expandable_segments:True"
|
16 |
-
os.environ["TOKENIZERS_PARALLELISM"] = "
|
17 |
torch._dynamo.config.suppress_errors = True
|
18 |
|
19 |
Pipeline = None
|
@@ -21,12 +21,11 @@ ids = "black-forest-labs/FLUX.1-schnell"
|
|
21 |
Revision = "741f7c3ce8b383c54771c7003378a50191e9efe9"
|
22 |
|
23 |
def load_pipeline() -> Pipeline:
|
24 |
-
vae =
|
25 |
-
quantize_(vae, int8_weight_only())
|
26 |
text_encoder_2 = T5EncoderModel.from_pretrained("city96/t5-v1_1-xxl-encoder-bf16", revision = "1b9c856aadb864af93c1dcdc226c2774fa67bc86", torch_dtype=torch.bfloat16).to(memory_format=torch.channels_last)
|
27 |
path = os.path.join(HF_HUB_CACHE, "models--RobertML--FLUX.1-schnell-int8wo/snapshots/307e0777d92df966a3c0f99f31a6ee8957a9857a")
|
28 |
transformer = FluxTransformer2DModel.from_pretrained(path, torch_dtype=torch.bfloat16, use_safetensors=False).to(memory_format=torch.channels_last)
|
29 |
-
pipeline = DiffusionPipeline.from_pretrained(ids, revision=Revision, transformer=transformer, text_encoder_2=text_encoder_2, torch_dtype=torch.bfloat16,)
|
30 |
pipeline.to("cuda")
|
31 |
|
32 |
for _ in range(3):
|
|
|
13 |
from torchao.quantization import quantize_, int8_weight_only, fpx_weight_only
|
14 |
|
15 |
os.environ['PYTORCH_CUDA_ALLOC_CONF']="expandable_segments:True"
|
16 |
+
os.environ["TOKENIZERS_PARALLELISM"] = "False"
|
17 |
torch._dynamo.config.suppress_errors = True
|
18 |
|
19 |
Pipeline = None
|
|
|
21 |
Revision = "741f7c3ce8b383c54771c7003378a50191e9efe9"
|
22 |
|
23 |
def load_pipeline() -> Pipeline:
|
24 |
+
vae = AutoencoderTiny.from_pretrained("slobers/tt1",revision="ec746bf42d91e3335760895281f070df54f2196a", torch_dtype=torch.bfloat16,)
|
|
|
25 |
text_encoder_2 = T5EncoderModel.from_pretrained("city96/t5-v1_1-xxl-encoder-bf16", revision = "1b9c856aadb864af93c1dcdc226c2774fa67bc86", torch_dtype=torch.bfloat16).to(memory_format=torch.channels_last)
|
26 |
path = os.path.join(HF_HUB_CACHE, "models--RobertML--FLUX.1-schnell-int8wo/snapshots/307e0777d92df966a3c0f99f31a6ee8957a9857a")
|
27 |
transformer = FluxTransformer2DModel.from_pretrained(path, torch_dtype=torch.bfloat16, use_safetensors=False).to(memory_format=torch.channels_last)
|
28 |
+
pipeline = DiffusionPipeline.from_pretrained(ids, revision=Revision, vae=vae, transformer=transformer, text_encoder_2=text_encoder_2, torch_dtype=torch.bfloat16,)
|
29 |
pipeline.to("cuda")
|
30 |
|
31 |
for _ in range(3):
|