Update README.md
Browse files
README.md
CHANGED
|
@@ -26,6 +26,8 @@ from diffusers import Flux2KleinPipeline, Flux2Transformer2DModel
|
|
| 26 |
from transformers.modeling_utils import no_init_weights
|
| 27 |
from dfloat11 import DFloat11Model
|
| 28 |
|
|
|
|
|
|
|
| 29 |
with no_init_weights():
|
| 30 |
transformer = Flux2Transformer2DModel.from_config(
|
| 31 |
Flux2Transformer2DModel.load_config(
|
|
@@ -35,7 +37,7 @@ with no_init_weights():
|
|
| 35 |
).to(torch.bfloat16)
|
| 36 |
DFloat11Model.from_pretrained("mingyi456/FLUX.2-klein-4B-DF11", device="cpu", bfloat16_model=transformer)
|
| 37 |
|
| 38 |
-
pipe = Flux2KleinPipeline.from_pretrained("black-forest-labs/FLUX.2-klein-4B", transformer=transformer, torch_dtype=torch.bfloat16)
|
| 39 |
pipe.to("cuda")
|
| 40 |
|
| 41 |
prompt = "A cat holding a sign that says hello world"
|
|
|
|
| 26 |
from transformers.modeling_utils import no_init_weights
|
| 27 |
from dfloat11 import DFloat11Model
|
| 28 |
|
| 29 |
+
text_encoder = DFloat11Model.from_pretrained("DFloat11/Qwen3-4B-DF11", device="cpu")
|
| 30 |
+
|
| 31 |
with no_init_weights():
|
| 32 |
transformer = Flux2Transformer2DModel.from_config(
|
| 33 |
Flux2Transformer2DModel.load_config(
|
|
|
|
| 37 |
).to(torch.bfloat16)
|
| 38 |
DFloat11Model.from_pretrained("mingyi456/FLUX.2-klein-4B-DF11", device="cpu", bfloat16_model=transformer)
|
| 39 |
|
| 40 |
+
pipe = Flux2KleinPipeline.from_pretrained("black-forest-labs/FLUX.2-klein-4B", text_encoder=text_encoder, transformer=transformer, torch_dtype=torch.bfloat16)
|
| 41 |
pipe.to("cuda")
|
| 42 |
|
| 43 |
prompt = "A cat holding a sign that says hello world"
|