File size: 4,067 Bytes
620f161
 
 
 
 
 
 
9be48ae
 
d588996
 
49c8905
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
620f161
6dcd905
f3daa0f
1e9d6ee
 
 
 
 
 
 
dd29caa
 
 
1e9d6ee
 
4088448
b9fe02c
1e9d6ee
 
6dcd905
1e9d6ee
6dcd905
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92ab2c6
6dcd905
ee56b90
6dcd905
 
 
 
 
 
 
d588996
 
 
fe3df6d
e481009
fe3df6d
f71810d
dd34375
 
7add3f3
dd34375
 
 
4088448
54394d8
dd34375
bb9593d
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
---
license: other
license_name: flux-1-dev-non-commercial-license
license_link: https://huggingface.co/black-forest-labs/FLUX.1-Krea-dev/blob/main/LICENSE.md
language:
- en
library_name: diffusers
base_model:
- black-forest-labs/FLUX.1-Krea-dev
pipeline_tag: text-to-image
widget:
- text: a frog holding a sign that says hello world
  output:
    url: output1.png
- text: a pig holding a sign that says hello world
  output:
    url: output2.png
- text: a wolf holding a sign that says hello world
  output:
    url: output3.png
- text: >-
    cute anime girl with massive fluffy fennec ears and a big fluffy tail blonde
    messy long hair blue eyes wearing a maid outfit with a long black gold leaf
    pattern dress and a white apron mouth open holding a fancy black forest cake
    with candles on top in the kitchen of an old dark Victorian mansion lit by
    candlelight with a bright window to the foggy forest and very expensive
    stuff everywhere
  output:
    url: workflow-embedded-demo1.png
- text: >-
    on a rainy night, a girl holds an umbrella and looks at the camera. The rain
    keeps falling.
  output:
    url: workflow-embedded-demo2.png
- text: drone shot of a volcano erupting with a pig walking on it
  output:
    url: workflow-embedded-demo3.png
tags:
- gguf-node
- gguf-connector
---
# **gguf quantized version of krea**
- run it straight with `gguf-connector`
- opt a `gguf` file in the current directory to interact with by:
```
ggc k
```
>
>GGUF file(s) available. Select which one to use:
>
>1. flux-krea-lite-q2_k.gguf
>2. flux-krea-lite-q4_0.gguf
>3. flux-krea-lite-q8_0.gguf
>
>Enter your choice (1 to 3): _
>
note: try experimental lite model with 8-step operation; save up to 70% loading time

![screenshot](https://raw.githubusercontent.com/calcuis/gguf-pack/master/k4.png)

- run it with diffusers (see example inference below)
```py
import torch
from transformers import T5EncoderModel
from diffusers import FluxPipeline, GGUFQuantizationConfig, FluxTransformer2DModel

model_path = "https://huggingface.co/calcuis/krea-gguf/blob/main/flux1-krea-dev-q2_k.gguf"
transformer = FluxTransformer2DModel.from_single_file(
    model_path,
    quantization_config=GGUFQuantizationConfig(compute_dtype=torch.bfloat16),
    torch_dtype=torch.bfloat16,
    config="callgg/krea-decoder",
    subfolder="transformer"
)

text_encoder = T5EncoderModel.from_pretrained(
    "chatpig/t5-v1_1-xxl-encoder-fp32-gguf",
    gguf_file="t5xxl-encoder-fp32-q2_k.gguf",
    torch_dtype=torch.bfloat16
    )

pipe = FluxPipeline.from_pretrained(
    "callgg/krea-decoder",
    transformer=transformer,
    text_encoder_2=text_encoder,
    torch_dtype=torch.bfloat16
    )
pipe.enable_model_cpu_offload() # could change it to cuda if you have good gpu

prompt = "a pig holding a sign that says hello world"
image = pipe(
    prompt,
    height=1024,
    width=1024,
    guidance_scale=2.5,
).images[0]
image.save("output.png")
```

<Gallery />

## **run it with gguf-node via comfyui**
- drag **krea** to > `./ComfyUI/models/diffusion_models`
- drag **clip-l-v2 [[248MB](https://huggingface.co/calcuis/kontext-gguf/blob/main/clip_l_v2_fp32-f16.gguf)], t5xxl [[2.75GB](https://huggingface.co/calcuis/kontext-gguf/blob/main/t5xxl_fp32-q4_0.gguf)]** to > `./ComfyUI/models/text_encoders`
- drag **pig [[168MB](https://huggingface.co/calcuis/kontext-gguf/blob/main/pig_flux_vae_fp32-f16.gguf)]** to > `./ComfyUI/models/vae`

![screenshot](https://raw.githubusercontent.com/calcuis/comfy/master/krea.png)

### **reference**
- base model from [black-forest-labs](https://huggingface.co/black-forest-labs)
- for model merge details, see [sayakpaul](https://huggingface.co/sayakpaul/FLUX.1-merged)
- diffusers from [huggingface](https://github.com/huggingface/diffusers)
- comfyui from [comfyanonymous](https://github.com/comfyanonymous/ComfyUI)
- gguf-node ([pypi](https://pypi.org/project/gguf-node)|[repo](https://github.com/calcuis/gguf)|[pack](https://github.com/calcuis/gguf/releases))
- gguf-connector ([pypi](https://pypi.org/project/gguf-connector))