Instructions to use NoMoreCopyrightOrg/flux-dev with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use NoMoreCopyrightOrg/flux-dev with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("NoMoreCopyrightOrg/flux-dev", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps
- Draw Things
- DiffusionBee
Upload handler.py
Browse files- handler.py +4 -2
handler.py
CHANGED
|
@@ -29,8 +29,10 @@ class EndpointHandler:
|
|
| 29 |
vae = AutoencoderKL.from_pretrained(repo_id, subfolder="vae", torch_dtype=dtype)
|
| 30 |
#transformer = FluxTransformer2DModel.from_pretrained(repo_id, subfolder="transformer", torch_dtype=dtype, quantization_config=quantization_config).to("cuda")
|
| 31 |
self.pipeline = FluxPipeline.from_pretrained(repo_id, vae=vae, torch_dtype=dtype, quantization_config=quantization_config)
|
| 32 |
-
self.pipeline.transformer.fuse_qkv_projections()
|
| 33 |
-
self.pipeline.
|
|
|
|
|
|
|
| 34 |
if IS_COMPILE: self.pipeline = compile_pipeline(self.pipeline)
|
| 35 |
self.pipeline.to(distributed_state.device)
|
| 36 |
|
|
|
|
| 29 |
vae = AutoencoderKL.from_pretrained(repo_id, subfolder="vae", torch_dtype=dtype)
|
| 30 |
#transformer = FluxTransformer2DModel.from_pretrained(repo_id, subfolder="transformer", torch_dtype=dtype, quantization_config=quantization_config).to("cuda")
|
| 31 |
self.pipeline = FluxPipeline.from_pretrained(repo_id, vae=vae, torch_dtype=dtype, quantization_config=quantization_config)
|
| 32 |
+
self.pipeline.transformer.fuse_qkv_projections()
|
| 33 |
+
self.pipeline.transformer.to(memory_format=torch.channels_last)
|
| 34 |
+
self.pipeline.vae.fuse_qkv_projections()
|
| 35 |
+
self.pipeline.vae.to(memory_format=torch.channels_last)
|
| 36 |
if IS_COMPILE: self.pipeline = compile_pipeline(self.pipeline)
|
| 37 |
self.pipeline.to(distributed_state.device)
|
| 38 |
|