LeanQuant commited on
Commit
c716d5a
·
verified ·
1 Parent(s): 92faebb

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. README.md +77 -0
  2. config.json +36 -0
  3. diffusion_pytorch_model.safetensors +3 -0
  4. single_transformer_blocks_0.safetensors +3 -0
  5. single_transformer_blocks_1.safetensors +3 -0
  6. single_transformer_blocks_10.safetensors +3 -0
  7. single_transformer_blocks_11.safetensors +3 -0
  8. single_transformer_blocks_12.safetensors +3 -0
  9. single_transformer_blocks_13.safetensors +3 -0
  10. single_transformer_blocks_14.safetensors +3 -0
  11. single_transformer_blocks_15.safetensors +3 -0
  12. single_transformer_blocks_16.safetensors +3 -0
  13. single_transformer_blocks_17.safetensors +3 -0
  14. single_transformer_blocks_18.safetensors +3 -0
  15. single_transformer_blocks_19.safetensors +3 -0
  16. single_transformer_blocks_2.safetensors +3 -0
  17. single_transformer_blocks_20.safetensors +3 -0
  18. single_transformer_blocks_21.safetensors +3 -0
  19. single_transformer_blocks_22.safetensors +3 -0
  20. single_transformer_blocks_23.safetensors +3 -0
  21. single_transformer_blocks_24.safetensors +3 -0
  22. single_transformer_blocks_25.safetensors +3 -0
  23. single_transformer_blocks_26.safetensors +3 -0
  24. single_transformer_blocks_27.safetensors +3 -0
  25. single_transformer_blocks_28.safetensors +3 -0
  26. single_transformer_blocks_29.safetensors +3 -0
  27. single_transformer_blocks_3.safetensors +3 -0
  28. single_transformer_blocks_30.safetensors +3 -0
  29. single_transformer_blocks_31.safetensors +3 -0
  30. single_transformer_blocks_32.safetensors +3 -0
  31. single_transformer_blocks_33.safetensors +3 -0
  32. single_transformer_blocks_34.safetensors +3 -0
  33. single_transformer_blocks_35.safetensors +3 -0
  34. single_transformer_blocks_36.safetensors +3 -0
  35. single_transformer_blocks_37.safetensors +3 -0
  36. single_transformer_blocks_4.safetensors +3 -0
  37. single_transformer_blocks_5.safetensors +3 -0
  38. single_transformer_blocks_6.safetensors +3 -0
  39. single_transformer_blocks_7.safetensors +3 -0
  40. single_transformer_blocks_8.safetensors +3 -0
  41. single_transformer_blocks_9.safetensors +3 -0
  42. transformer_blocks_0.safetensors +3 -0
  43. transformer_blocks_1.safetensors +3 -0
  44. transformer_blocks_10.safetensors +3 -0
  45. transformer_blocks_11.safetensors +3 -0
  46. transformer_blocks_12.safetensors +3 -0
  47. transformer_blocks_13.safetensors +3 -0
  48. transformer_blocks_14.safetensors +3 -0
  49. transformer_blocks_15.safetensors +3 -0
  50. transformer_blocks_16.safetensors +3 -0
README.md ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model:
3
+ - black-forest-labs/FLUX.1-Canny-dev
4
+ base_model_relation: quantized
5
+ pipeline_tag: text-to-image
6
+ tags:
7
+ - dfloat11
8
+ - df11
9
+ - lossless compression
10
+ - 70% size, 100% accuracy
11
+ ---
12
+
13
+ ## DFloat11 Compressed Model: `black-forest-labs/FLUX.1-Canny-dev`
14
+
15
+ This is a **losslessly compressed** version of [`black-forest-labs/FLUX.1-Canny-dev`](https://huggingface.co/black-forest-labs/FLUX.1-Canny-dev) using our custom **DFloat11** format. The outputs of this compressed model are **bit-for-bit identical** to the original BFloat16 model, while reducing GPU memory consumption by approximately **30%**.
16
+
17
+ ### 🔍 How It Works
18
+
19
+ DFloat11 compresses model weights using **Huffman coding** of BFloat16 exponent bits, combined with **hardware-aware algorithmic designs** that enable efficient on-the-fly decompression directly on the GPU. During inference, the weights remain compressed in GPU memory and are **decompressed just before matrix multiplications**, then **immediately discarded after use** to minimize memory footprint.
20
+
21
+ Key benefits:
22
+
23
+ * **No CPU decompression or host-device data transfer**: all operations are handled entirely on the GPU.
24
+ * DFloat11 is **much faster than CPU-offloading approaches**, enabling practical deployment in memory-constrained environments.
25
+ * The compression is **fully lossless**, guaranteeing that the model’s outputs are **bit-for-bit identical** to those of the original model.
26
+
27
+ ### 🔧 How to Use
28
+
29
+ 1. Install or upgrade the DFloat11 pip package *(installs the CUDA kernel automatically; requires a CUDA-compatible GPU and PyTorch installed)*:
30
+
31
+ ```bash
32
+ pip install -U dfloat11[cuda12]
33
+ # or if you have CUDA version 11:
34
+ # pip install -U dfloat11[cuda11]
35
+ ```
36
+
37
+ 2. Install or upgrade the diffusers and controlnet_aux packages.
38
+
39
+ ```bash
40
+ pip install -U diffusers controlnet_aux
41
+ ```
42
+
43
+ 3. To use the DFloat11 model, run the following example code in Python:
44
+ ```python
45
+ import torch
46
+ from controlnet_aux import CannyDetector
47
+ from diffusers import FluxControlPipeline
48
+ from diffusers.utils import load_image
49
+ from dfloat11 import DFloat11Model
50
+
51
+ pipe = FluxControlPipeline.from_pretrained("black-forest-labs/FLUX.1-Canny-dev", torch_dtype=torch.bfloat16)
52
+ pipe.enable_model_cpu_offload()
53
+
54
+ DFloat11Model.from_pretrained('DFloat11/FLUX.1-Canny-dev-DF11', device='cpu', bfloat16_model=pipe.transformer)
55
+
56
+ prompt = "A robot made of exotic candies and chocolates of different kinds. The background is filled with confetti and celebratory gifts."
57
+ control_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/robot.png")
58
+
59
+ processor = CannyDetector()
60
+ control_image = processor(control_image, low_threshold=50, high_threshold=200, detect_resolution=1024, image_resolution=1024)
61
+
62
+ image = pipe(
63
+ prompt=prompt,
64
+ control_image=control_image,
65
+ height=1024,
66
+ width=1024,
67
+ num_inference_steps=50,
68
+ guidance_scale=30.0,
69
+ ).images[0]
70
+ image.save("output.png")
71
+ ```
72
+
73
+ ### 📄 Learn More
74
+
75
+ * **Paper**: [70% Size, 100% Accuracy: Lossless LLM Compression for Efficient GPU Inference via Dynamic-Length Float](https://arxiv.org/abs/2504.11651)
76
+ * **GitHub**: [https://github.com/LeanModels/DFloat11](https://github.com/LeanModels/DFloat11)
77
+ * **HuggingFace**: [https://huggingface.co/DFloat11](https://huggingface.co/DFloat11)
config.json ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "dfloat11_config": {
3
+ "bytes_per_thread": 8,
4
+ "pattern_dict": {
5
+ "transformer_blocks.\\d+": [
6
+ "norm1.linear",
7
+ "norm1_context.linear",
8
+ "attn.to_q",
9
+ "attn.to_k",
10
+ "attn.to_v",
11
+ "attn.add_k_proj",
12
+ "attn.add_v_proj",
13
+ "attn.add_q_proj",
14
+ "attn.to_out.0",
15
+ "attn.to_add_out",
16
+ "ff.net.0.proj",
17
+ "ff.net.2",
18
+ "ff_context.net.0.proj",
19
+ "ff_context.net.2"
20
+ ],
21
+ "single_transformer_blocks.\\d+": [
22
+ "norm.linear",
23
+ "proj_mlp",
24
+ "proj_out",
25
+ "attn.to_q",
26
+ "attn.to_k",
27
+ "attn.to_v"
28
+ ]
29
+ },
30
+ "threads_per_block": [
31
+ 512
32
+ ],
33
+ "version": "0.2.0"
34
+ },
35
+ "model_type": "llama"
36
+ }
diffusion_pytorch_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9ebc671b3682073d78148df31ccc36dd5e3deb8083a7097004f586a25a021bd2
3
+ size 128645392
single_transformer_blocks_0.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d208c941917acdac6f9c9905dc1576c844434aaea035ea76c89c824b4051d547
3
+ size 191949057
single_transformer_blocks_1.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0d02ab842457371d4982509efa185025a45bdd0a063d32022fded7d7fb332a81
3
+ size 192029608
single_transformer_blocks_10.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6013e0a8b21c04f545d475164841e511e4f33b8f698ae2eb11f0439d87dca053
3
+ size 193125717
single_transformer_blocks_11.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ad792a5206a04a8fcabe2c2e953bd66dfab8ceb08c60adc3d62f83775bc551ec
3
+ size 193358207
single_transformer_blocks_12.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:50de2eafa927d3b17b4d69f6f962c1bb1dece4e59782a767bd47ca313a5ad964
3
+ size 193528392
single_transformer_blocks_13.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:90d9a03fcf77a58b64a5d33c263440e9ec654f5088788d0afb8306b44d1d3c93
3
+ size 193552826
single_transformer_blocks_14.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e7abd2b1e502b92950c1c4ff15e3d4eb1f3610ac49a9f7d936f9981370ac480b
3
+ size 193545338
single_transformer_blocks_15.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c9f1f7018cc0ef5e7dc7198f757b088c60935d3963158bf6528b43bd9cb721d
3
+ size 193503866
single_transformer_blocks_16.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:83b02462aa28dcbde37468cf72a6ecdb6f661aadc2d4195b21c139f9de6f065f
3
+ size 193524822
single_transformer_blocks_17.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f65ecedd5be79105f21a30abe27533495f44f8d5c915b574f4e9ee54dbaf66e8
3
+ size 193656428
single_transformer_blocks_18.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dc13770d24b872b6174e77f8a41c20fcfd8bbcd59f7ee095a5794c07c68d2e52
3
+ size 193724567
single_transformer_blocks_19.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c7ee917a63d43b9b7427191ec48081a40c027874a548b66d2cd19d252ba3ed31
3
+ size 193730646
single_transformer_blocks_2.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:96774e4cfe52d1f5fd60a7b78ea018b74610411dd34e970b23e1650787e6f3ee
3
+ size 192068254
single_transformer_blocks_20.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:70352c0166860f36feef08c805d96c858ec391e80306d999f667280d361b7620
3
+ size 193796473
single_transformer_blocks_21.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:686f3fb0dcf3f3c92c55e318d99706920a0e993a3064fde0543d7a9f1ce837ca
3
+ size 194032581
single_transformer_blocks_22.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8fc685d94d38a00a751395b765265bb03a201e627e05d59aebe6768c06ea5d86
3
+ size 194167140
single_transformer_blocks_23.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:634a05ce2aec951dfc89e9e833cfc2a29d7b7cd4285b1654d162e90206f4a5c2
3
+ size 194395067
single_transformer_blocks_24.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b0c7353fe46dcc99acbc83c07a47dcf33bb9f6db671c9c33bca11dc6a6d034a4
3
+ size 194442281
single_transformer_blocks_25.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:78a46c02306f90d9193f79479f91aa22fe9138f581a0076805a92e11dbfe574b
3
+ size 194731486
single_transformer_blocks_26.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3dbbddc3b9c05e1acc37a8a5a0a886b4637befd8eaccea8e1ecede006c9d2db5
3
+ size 194805644
single_transformer_blocks_27.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a7fdb054ddf5406b3cadb03e7ad1f2e7226c62745d5ce7efe6fa550348537008
3
+ size 195138144
single_transformer_blocks_28.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b2754c361beba131f1ce5a3c20425d3cae0a3b9fc535427a8823294c41f0b544
3
+ size 195324189
single_transformer_blocks_29.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bad140b2e58dc13a16afe4e19b63fc9cc4e60df4ef83435ee10fe9d8f8923a71
3
+ size 195144191
single_transformer_blocks_3.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4c4b60256c4c008b63b57f5d6cad5e4e1818c1676784b73ce3a932f973754cb8
3
+ size 192142735
single_transformer_blocks_30.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3682dabb2c1bbfdf1019638cdc409cc1ef9bc94639177daae858c2c19b10fe59
3
+ size 195636459
single_transformer_blocks_31.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6d7c93f8dd723901916ede6b816bdbd861d996aa7a414672ce33606cc82a7b75
3
+ size 195801254
single_transformer_blocks_32.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4b71cd2708281c6011fa63b41a92f0cd5e85bdbb7bb37d0716664a4a6e9d3aa8
3
+ size 195763643
single_transformer_blocks_33.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9c7df06ea1ac232070a731beb1cb1c5282bb1e6eca6a78099344563366e25f87
3
+ size 195816027
single_transformer_blocks_34.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c4f3161a49fd58771abf638f81444c680c963fc7a6c0d21b3d015788b633f7e9
3
+ size 196103878
single_transformer_blocks_35.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6af965e993858247229dbdbfb6a3fa3264cd87b9d4edde0641436e5a619faafb
3
+ size 196365559
single_transformer_blocks_36.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9ffb82260b3377812b4ac70750a3e30e64dbd6d6948ca9eeba00aa64d844a204
3
+ size 194705836
single_transformer_blocks_37.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1fcc4111262af47c5493a2cf59420833b4b1f7e5ad13510e2b7cb763780f3fe8
3
+ size 196473909
single_transformer_blocks_4.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4268c3086d4d2cea892966d30c562f3fcb417cf9714acff0cc37b57aa9946b7e
3
+ size 192205856
single_transformer_blocks_5.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1f9695ae49b29f4d2216a599bc86a985160e59076ed7568e1e6fea0382677442
3
+ size 192384763
single_transformer_blocks_6.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ff77155df256410ffe20f4b1e9feb593ac74c1f3ca5473541aee1de3f35062c8
3
+ size 192509946
single_transformer_blocks_7.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c29b58ea2a0bd6c37980399601547df2700464bd5bf6da4144cc554d18e02b12
3
+ size 192615904
single_transformer_blocks_8.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e7947c436180db6f5a230714725a6efdb018f7b69babbe6f76202a1bce2950c8
3
+ size 192851576
single_transformer_blocks_9.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:682c056a51b03059746bea65a3f71a26464e823f923f23588c700ffad7a06aa2
3
+ size 192994120
transformer_blocks_0.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5b3fdd79bdf093c95dccafc4a61d29e5dfb1ccd0f6d7d0d7a4f751fe82eb49f0
3
+ size 471010413
transformer_blocks_1.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9f71776dea4f40f011aca8427c7fbee647def76638762dfc5a822aa51e95c9dc
3
+ size 471483133
transformer_blocks_10.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a6e2382645b55c213045f0a60a5a0471b3b241a3d000e3d1640861927a138922
3
+ size 463497433
transformer_blocks_11.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a88074168ae51b505c19bdfc2d0bfb4665f71ad62f67e1ae21bf02910cc316fc
3
+ size 462836192
transformer_blocks_12.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:00ec54aea3ffb04729cfa97987d81e9133b942c8185d1f5705d2c83751d91511
3
+ size 462774477
transformer_blocks_13.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4257bc49b91cd79d40e1edd53b5068974210c511ebf424d3791e7389fb6785dc
3
+ size 463819302
transformer_blocks_14.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:428e009b6f541b433eb15e2f23a176f7bc1d13f13ca5d8c069132164c4d04510
3
+ size 462421442
transformer_blocks_15.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f959ccc4358dadf16a13bc0f4a4c455bf778545f73454296d4c3c87f2564ce0a
3
+ size 461488340
transformer_blocks_16.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fa40c45e54f665e18e94657d4489a7f3c5ff469b0a24cdf0087975924ea4b8af
3
+ size 461555156