Skip to content

Commit 665aacd

Browse files
committed
remove k-quant tempoarily
Signed-off-by: Isotr0py <[email protected]>
1 parent 942252e commit 665aacd

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

run_gguf.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import torch
2+
3+
from diffusers import FluxPipeline, FluxTransformer2DModel, GGUFQuantizationConfig
4+
5+
ckpt_path = (
6+
"/home/mozf/LLM/flux1-dev-Q4_0.gguf"
7+
)
8+
transformer = FluxTransformer2DModel.from_single_file(
9+
ckpt_path,
10+
quantization_config=GGUFQuantizationConfig(compute_dtype=torch.bfloat16),
11+
torch_dtype=torch.bfloat16,
12+
)
13+
pipe = FluxPipeline.from_pretrained(
14+
"/home/mozf/LLM/FLUX.1-dev",
15+
transformer=transformer,
16+
torch_dtype=torch.bfloat16,
17+
).to("cuda")
18+
19+
20+
# pipe.enable_model_cpu_offload()
21+
pipe.transformer.to(memory_format=torch.channels_last)
22+
pipe.transformer.compile(mode="reduce-overhead", fullgraph=True)
23+
24+
prompt = "A cat holding a sign that says hello world"
25+
image = pipe(prompt, generator=torch.manual_seed(0)).images[0]
26+
# image.save("flux-gguf.png")
27+
28+
prompt = "A cat holding a sign that says hello world"
29+
image = pipe(prompt, generator=torch.manual_seed(0)).images[0]
30+
image.save("flux-gguf.png")

0 commit comments

Comments
 (0)