city96 commited on
Commit
c411165
1 Parent(s): a6e4f05

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +94 -0
README.md ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: black-forest-labs/FLUX.1-dev
3
+ base_model_relation: merge
4
+ library_name: gguf
5
+ license: other
6
+ license_name: flux-1-dev-non-commercial-license
7
+ license_link: LICENSE.md
8
+ tags:
9
+ - text-to-image
10
+ - image-generation
11
+ - flux
12
+ - merge
13
+ ---
14
+
15
+ ![Main cover](./raw/img_main_cover.jpg)
16
+
17
+ # Do you feel like you have too much VRAM lately? Want to OOM on a 40GB A100? **This is the model for you!**
18
+
19
+ ---
20
+
21
+ # **About**
22
+
23
+ This is a **17B self-merge** of the original 12B parameter [Flux.1-dev](https://huggingface.co/black-forest-labs/FLUX.1-dev) model.
24
+
25
+ Merging was done similarly to 70B->120B LLM merges, with the layers repeated and interwoven in groups.
26
+
27
+ ```
28
+ Final model stats:
29
+ p layers: [ 32]
30
+ s layers: [ 44]
31
+ n params: [17.17B]
32
+ ```
33
+
34
+ ## Training
35
+
36
+ Some post-merge training was done to try and reverse the extensive braindamage the model has suffered, but even after that this is mostly a **proof of concept** due to not having any hardware capable of properly training this. Still, I think it might be the first open source 17B image model that actually generates coherent images, even if it's just a self-merge.
37
+
38
+ You can see the text recovering with training. Leftmost image is step 0 base merge:
39
+
40
+ ![Training](./raw/img_train_recovery.jpg)
41
+
42
+ ---
43
+
44
+ # **Usage**
45
+
46
+ *Good luck.*
47
+
48
+ ### Diffusers
49
+
50
+ Should work with inference pipeline, `from_single_file` seems to need the custom layer counts passed:
51
+
52
+ ```
53
+ model = FluxTransformer2DModel.from_single_file("flux.1-heavy-17B.safetensors", num_layers=32, num_single_layers=44)
54
+ ```
55
+
56
+ ### Comfy
57
+
58
+ Just load it normally via the "Load Diffusion Model" node. You need like 80GBs of system RAM on windows for it to not swap to disk lol.
59
+
60
+ It requires about 35-40GBs of VRAM for inference, assuming you offloat the text encoder and unload it during VAE decoding. Partial offloading works if you have enough system RAM.
61
+
62
+ ### Training
63
+
64
+ Seems to work out of the box with [ostris/ai-toolkit](https://github.com/ostris/ai-toolkit), at least it did when I pointed `config -> process -> model -> name_or_path` to it in a local folder.
65
+
66
+ ---
67
+
68
+ # **Q&A**:
69
+
70
+ ## Should I use this model?
71
+
72
+ No unless you want to brag about it or God forbid train it into something usable.
73
+
74
+ ## Where is the merge script?
75
+
76
+ It's a mess of like 3-4 scripts and some questionable manual editing on some of the biases. You can replicate it if you put the layers after each other with some overlap similarly to [this](https://huggingface.co/alpindale/goliath-120b#merge-process), just leave the later single layers alone.
77
+
78
+ The merged (untrained) weights are in this repo in the raw folder. You can `from_single_file -> save pretrained` w/ FluxTransformer2DModel if you need those in the diffusers format.
79
+
80
+ ## GGUF? FP8?
81
+
82
+ It's essential to experience this model in BF16 precision for the full experience of running out of every kind of resources at the same time while trying to run it.
83
+
84
+ (I'd put some up but I'm out out runpod credits again)
85
+
86
+ ## Settings? LoRA compatibility?
87
+
88
+ Just use the same settings you'd use for regular flux. LoRAs do seem to have at least some effect, but the blocks don't line up so don't expect them to work amazingly.
89
+
90
+ ## Does this generate coherent images?
91
+
92
+ Yes but text and general prompt adherence can be questionable. Example failure mode for text:
93
+
94
+ ![Main cover](./raw/img_text_fail.jpg)