Add local models via Git LFS (23 models, ~143 GB)
This commit is contained in:
parent
94b5c12c2d
commit
9b381fb3de
246 changed files with 38788 additions and 0 deletions
36
image/gemlite/prism-ml/bonsai-image-ternary-4B-gemlite-2bit/.gitattributes
vendored
Normal file
36
image/gemlite/prism-ml/bonsai-image-ternary-4B-gemlite-2bit/.gitattributes
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||
*.model filter=lfs diff=lfs merge=lfs -text
|
||||
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||
text_encoder-hqq-4bit/tokenizer/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
||||
|
|
@ -0,0 +1,177 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
This software is copyright 2026-present Prism ML, Inc. It is available under the Apache 2.0 license.
|
||||
If you publicly deploy or redistribute this software, we would appreciate attribution such as: "Created using Bonsai Image by Prism ML."
|
||||
|
||||
This software is built from FLUX.2 [klein] 4B, Copyright 2026 Black Forest Labs, which is available under the Apache 2.0 License: https://huggingface.co/black-forest-labs/FLUX.2-klein-4B/blob/main/LICENSE.md
|
||||
|
||||
The text encoder is built from Qwen3-4B, Copyright 2024 Alibaba Cloud, which is available under the Apache 2.0 License: https://huggingface.co/Qwen/Qwen3-4B/blob/main/LICENSE
|
||||
|
|
@ -0,0 +1,224 @@
|
|||
---
|
||||
license: apache-2.0
|
||||
pipeline_tag: text-to-image
|
||||
tags:
|
||||
- ternary
|
||||
- 1.58-bit
|
||||
- gemlite
|
||||
- hqq
|
||||
- cuda
|
||||
- text-to-image
|
||||
- diffusion
|
||||
- flux
|
||||
- prismml
|
||||
- bonsai
|
||||
base_model:
|
||||
- prism-ml/bonsai-image-ternary-4B-unpacked
|
||||
---
|
||||
|
||||
<p align="center">
|
||||
<img src="./assets/bonsai-logo.svg" width="280" alt="Bonsai Image">
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://prismml.com"><b>Prism ML Website</b></a> |
|
||||
<a href="https://github.com/PrismML-Eng/Bonsai-Image-Demo/blob/main/bonsai-image-4b-whitepaper.pdf"><b>White Paper</b></a> |
|
||||
<a href="https://github.com/PrismML-Eng/Bonsai-Image-Demo"><b>Demo & Examples</b></a> |
|
||||
<a href="https://discord.gg/prismml"><b>Discord</b></a>
|
||||
</p>
|
||||
|
||||
# bonsai-image-ternary-4B-gemlite-2bit
|
||||
|
||||
Ternary weight (1.58-bit) text-to-image diffusion transformer deployment for NVIDIA GPUs
|
||||
|
||||
> **1.21 GB transformer** | **6.4×** smaller than FP16 | **4.5 s / 1024²** on RTX 3080 | **2.8 s / 1024²** on A100 | runs natively on Linux and Windows
|
||||
|
||||
## Highlights
|
||||
|
||||
- **1.21 GB** diffusion transformer, down from **7.75 GB** for the FP16 FLUX.2 Klein 4B transformer
|
||||
- Ternary {-1, 0, +1} transformer weights with FP16 group-wise scaling in the matrix-heavy transformer layers (Q/K/V projections, output projections, MLP weights)
|
||||
- Quality-oriented Bonsai Image variant: the additional zero state improves visual quality and prompt fidelity while keeping the transformer compact
|
||||
- 4.55 GB CUDA deployment payload including the 4-bit text encoder and FP16 VAE — text encoder is offloaded after prompt encode, so the denoising loop only keeps the compact transformer and VAE resident
|
||||
- 4-step FlowMatch-Euler sampler with guidance = 1.0 and shift = 3.0 — no CFG, no negative prompts needed
|
||||
- Gemlite low-bit GEMM path for NVIDIA GPUs, with HQQ used for the compressed text encoder
|
||||
- Runs on Linux and Windows natively through the same CUDA / Gemlite deployment stack
|
||||
- Cross-platform companion: also available as [MLX 2-bit](https://huggingface.co/prism-ml/bonsai-image-ternary-4B-mlx-2bit) for Apple Silicon
|
||||
|
||||
## Resources
|
||||
|
||||
- **[White Paper](https://github.com/PrismML-Eng/Bonsai-Image-Demo/blob/main/bonsai-image-4b-whitepaper.pdf)** — full benchmarks, kernels, and memory analysis
|
||||
- **[Demo repo](https://github.com/PrismML-Eng/Bonsai-Image-Demo)** — one-command setup for Mac / Linux / Windows
|
||||
- **[Discord](https://discord.gg/prismml)** — community + support
|
||||
- **Kernels**: [gemlite](https://github.com/mobiusml/gemlite) (fused low-bit GEMM) · [HQQ](https://github.com/mobiusml/hqq) (low-bit quantization runtime) · [triton-windows](https://github.com/triton-lang/triton-windows) (Windows path)
|
||||
|
||||
## Model Overview
|
||||
|
||||
| Item | Specification |
|
||||
| :-------------------- | :----------------------------------------------------------------------------------------------|
|
||||
| Base architecture | FLUX.2 Klein 4B (MMDiT diffusion transformer) |
|
||||
| Parameters | ~4.0B (transformer trunk) |
|
||||
| Blocks | 25 MMDiT blocks: 5 double-stream + 20 single-stream |
|
||||
| Sampler | FlowMatchEuler, **4 steps**, guidance = 1.0, shift = 3.0 |
|
||||
| Text encoder | Qwen3-4B at 4-bit HQQ (≈ 2.84 GB CUDA payload, offloaded after prompt encode) |
|
||||
| VAE | Flux2 32-channel latent, tiled decode (128 px tiles) |
|
||||
| Native resolution | 1024×1024 (also supports 512×512 and arbitrary multiples of 32) |
|
||||
| Weight format | Gemlite INT2 pack, ternary values + FP16 group-wise scales |
|
||||
| **Transformer size** | **1.21 GB** model-level Bonsai representation; **1.54 GB** CUDA packed deployment size |
|
||||
| Total payload | **4.55 GB** CUDA deployment payload (transformer + 4-bit text encoder + FP16 VAE) |
|
||||
| Ternary coverage | All 100 matmul-heavy linears in the 25 MMDiT blocks |
|
||||
| Platforms | Linux x86_64 + Windows native on NVIDIA GPUs |
|
||||
| License | Apache 2.0 |
|
||||
|
||||
## Ternary Weight Representation: 1.58-bit g128
|
||||
|
||||
Each ternary weight takes a value from {−1, 0, +1} with one shared FP16 scale per group of 128 weights:
|
||||
|
||||
```text
|
||||
w_i = scale_g * t_i, t_i in {−1, 0, +1}
|
||||
```
|
||||
|
||||
Ternary values carry log₂(3) ≈ 1.585 bits of information per weight. With one FP16 scale per group of 128, the effective storage is:
|
||||
|
||||
```text
|
||||
b_eff ≈ log2(3) + 16/128 ≈ 1.585 + 0.125 ≈ 1.71 bits/weight
|
||||
```
|
||||
|
||||
This gives an idealized **9.4× reduction** relative to FP16 for the ternary transformer layers. A small set of precision-sensitive supporting tensors remains in FP16, so the final Ternary Bonsai Image 4B diffusion transformer is **1.21 GB**, a 6.4x reduction from the 7.75 GB FP16 FLUX.2 Klein 4B transformer.
|
||||
|
||||
The ternary representation is applied to the matrix-heavy transformer layers, including Q / K / V projections, output projections, MLP linears, and the double-stream add-K / Q / V linears. Supporting tensors (less than 5% of the total parameters) such as modulation streams, embedders, output norm, and output projection remain FP16 for image quality and stability.
|
||||
|
||||
The CUDA deployment uses a Gemlite INT2 packed format. Ternary values are stored in 2-bit slots, with the fourth code unused. The model-level Bonsai representation is **1.21 GB**; the deployed CUDA pack is **1.54 GB** on disk due to runtime packing and alignment overhead in the current Gemlite path.
|
||||
|
||||
### Memory
|
||||
|
||||
| Format | Transformer size | Reduction | Ratio |
|
||||
| :------------------------------ | ---------------: | --------: | -------: |
|
||||
| FP16 FLUX.2 Klein 4B | 7.75 GB | — | 1.0× |
|
||||
| **Ternary Bonsai Image 4B** | **1.21 GB** | **84.4%** | **6.4×** |
|
||||
|
||||
CUDA deployment:
|
||||
|
||||
| Component | Size |
|
||||
| :--------------------------------- | ------: |
|
||||
| Gemlite INT2 diffusion transformer | 1.54 GB |
|
||||
| HQQ 4-bit text encoder | 2.84 GB |
|
||||
| FP16 VAE | 0.17 GB |
|
||||
| **Total payload** | **4.55 GB** |
|
||||
|
||||
At runtime, the text encoder is offloaded after prompt encoding. During denoising, the repeated image-generation loop is dominated by the compact ternary diffusion transformer and active image-generation components rather than the full payload.
|
||||
|
||||
Peak HBM at 1024² on RTX 3080 is ~6.8 GiB end-to-end (transformer + VAE + activation memory).
|
||||
|
||||
## Best Practices
|
||||
|
||||
- Sampler: FlowMatchEuler-discrete with 4 steps, guidance = 1.0, shift = 3.0. The model is designed for 4 steps; running more steps does not improve quality significantly and can introduce artifacts.
|
||||
- Resolution: native 1024² is the design target. 512² works for quick previews.
|
||||
- Aspect ratios: multiples of 32 are supported, including 832x1248 and 1248x832.
|
||||
- Prompting: natural-language prompts. Negative prompts are not required.
|
||||
- Runtime memory: the text encoder is offloaded after prompt encoding, so the denoising loop is memory-light.
|
||||
|
||||
## Quickstart
|
||||
|
||||
### Bonsai Studio (Linux / Windows)
|
||||
|
||||
The simplest path is the [Bonsai Image Demo repo](https://github.com/PrismML-Eng/Bonsai-Image-Demo), which sets up the full Bonsai Studio (FastAPI backend + Next.js frontend) and selects gemlite automatically on Linux / Windows:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/PrismML-Eng/Bonsai-Image-Demo.git
|
||||
cd Bonsai-Image-Demo
|
||||
./setup.sh
|
||||
./scripts/download_model.sh # ternary is the default
|
||||
./scripts/serve.sh
|
||||
```
|
||||
|
||||
On Windows (PowerShell):
|
||||
|
||||
```powershell
|
||||
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned # one-time
|
||||
.\setup.ps1
|
||||
.\scripts\download_model.ps1
|
||||
.\scripts\serve.ps1
|
||||
```
|
||||
|
||||
### Python API (backend_gpu)
|
||||
|
||||
For inference without the studio frontend:
|
||||
|
||||
```python
|
||||
from backend_gpu.server import build_pipeline
|
||||
|
||||
pipe = build_pipeline(model_id="prism-ml/bonsai-image-ternary-4B-gemlite-2bit")
|
||||
image = pipe(
|
||||
prompt="A bonsai tree in a quiet ceramic studio, soft morning light",
|
||||
num_inference_steps=4,
|
||||
guidance_scale=1.0,
|
||||
height=1024,
|
||||
width=1024,
|
||||
).images[0]
|
||||
image.save("bonsai.png")
|
||||
```
|
||||
|
||||
## Throughput (CUDA / gemlite)
|
||||
|
||||
Warmed wall-clock per image, 4 denoising steps, guidance = 1.0, matched prompts and sampler settings.
|
||||
|
||||
| Platform | 512² (s) | 1024² (s) | Notes |
|
||||
| :------------------------ | -------: | --------: | :------------------------------------------ |
|
||||
| **A100** (Colab) | 1.1 | **2.8** | Ampere datacenter (40 GB) |
|
||||
| **RTX PRO 6000 Blackwell** (Colab) | 1.0 | **2.1** | NVIDIA Blackwell, 96 GB VRAM |
|
||||
| **RTX 3080** 10 GB | 1.4 | **4.5** | Ampere consumer; 6.8 GiB peak HBM at 1024² |
|
||||
| **RTX 3060** 6 GB (laptop)| 3.3 | 17.5 | Ampere mobile; memory-bound at 1024² |
|
||||
|
||||
The sub-2-bit pack keeps generation viable on commodity GPUs at 1024². The RTX 3080 10 GB reaches 4.5 s/image, while the 6 GB laptop RTX 3060 is the memory-constrained tail.
|
||||
|
||||
## Benchmarks
|
||||
|
||||
Evaluated with matched generation settings across the comparison set on H100. GenEval uses the official 512x512 protocol. For HPSv3 and DPG-Bench, larger-backbone rows are evaluated at 1024x1024, while smaller-backbone rows are evaluated at their native 512x512 setting. Higher is better for all three benchmarks.
|
||||
|
||||
| Model | Transformer (GB) | GenEval | HPSv3 | DPG-Bench |
|
||||
| :--------------------------- | ---------------: | ------: | -----: | --------: |
|
||||
| **Bonsai Image · Ternary 4B**| **1.21** | **0.723** | **12.22** | **0.851** |
|
||||
| **Bonsai Image · Binary 4B** | **0.93** | **0.671** | **11.15** | **0.822** |
|
||||
| FLUX.2 Klein 4B | 7.75 | 0.819 | 12.84 | 0.853 |
|
||||
| FLUX.1-schnell | 23.8 | 0.716 | 12.67 | 0.848 |
|
||||
| SDXL | 5.14 | 0.300 | 10.05 | 0.740 |
|
||||
| PixArt-Σ XL 2 | 1.20 | 0.541 | 11.93 | 0.769 |
|
||||
| Stable Diffusion 1.5 | 1.72 | 0.396 | 4.20 | 0.601 |
|
||||
| BK-SDM-Small | 0.98 | 0.297 | 3.05 | 0.559 |
|
||||
|
||||
The benchmark results show the intended quality-footprint trade-off. Ternary Bonsai Image 4B is the quality-oriented variant: at 1.21 GB, it sits very close to FLUX.2 Klein 4B across GenEval, HPSv3, and DPG-Bench while reducing the diffusion transformer footprint by 6.4x. The binary companion is the footprint-oriented variant, reducing the diffusion transformer below 1 GB while still delivering strong benchmark results.
|
||||
|
||||
Together, the Bonsai Image variants move the quality-footprint frontier: they bring modern diffusion-transformer behavior into a memory range previously occupied by much smaller, lower-capability models.
|
||||
|
||||
## Use Cases
|
||||
|
||||
- **Local creative tooling**: image generation directly on CUDA-equipped workstations and consumer GPUs
|
||||
- **Private generation**: prompts and generated assets can remain in local or controlled environments
|
||||
- **Rapid iteration**: lower local latency and no remote queue for iterative creative workflows
|
||||
- **Commodity-GPU serving**: lower transformer footprint and reduced memory pressure for serving on NVIDIA GPUs
|
||||
- **Windows and Linux deployment**: native paths through the same Gemlite deployment stack
|
||||
- **Enterprise and controlled inference**: local or private environments for data residency and compliance-sensitive workflows
|
||||
|
||||
## Limitations
|
||||
|
||||
- Ternary Bonsai Image 4B is not bit-identical to the FP16 FLUX.2 Klein 4B model; it is a compact ternary-weight deployment designed to deliver similar practical behavior at much smaller size.
|
||||
- Image-generation quality remains prompt- and workflow-dependent. Small text, fine details, object counts, and strict compositional constraints should be evaluated for the target use case.
|
||||
- Current commodity inference stacks do not yet expose fully native ternary execution as a standard hardware path. This release uses practical Gemlite low-bit GEMM kernels on CUDA.
|
||||
- After the diffusion transformer is made compact, other components such as the VAE can become more visible memory bottlenecks. The runtime mitigates this with text-encoder offload and tiled VAE decoding.
|
||||
|
||||
|
||||
## Citation
|
||||
|
||||
```bibtex
|
||||
@techreport{bonsaiimage4b,
|
||||
title = {Bonsai Image 4B: Low-Bit Diffusion on Apple Silicon and Consumer GPUs},
|
||||
author = {Prism ML},
|
||||
year = {2026},
|
||||
month = {May},
|
||||
url = {https://prismml.com}
|
||||
}
|
||||
```
|
||||
|
||||
## Contact
|
||||
|
||||
For questions, feedback, or collaboration inquiries: **contact@prismml.com**
|
||||
|
|
@ -0,0 +1 @@
|
|||
<svg width="24" height="15" viewBox="0 0 24 15" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M15.1304 6.25864H12L14.087 10.4311L6.78261 14.6035H16.1739L20.3478 10.4311L15.1304 6.25864Z" fill="#262C35"/><path d="M16.7826 6.25866H24V8.34488H19.4022L16.7826 6.25866Z" fill="#262C35"/><path d="M0 6.25866H10.837L11.8804 8.34488H0V6.25866Z" fill="#262C35"/><path d="M5.21739 3.12933H20.8696V5.21555H5.21739V3.12933Z" fill="#262C35"/><path d="M10.4348 0H17.7391V2.08622H10.4348V0Z" fill="#262C35"/></svg>
|
||||
|
After Width: | Height: | Size: 510 B |
|
|
@ -0,0 +1,101 @@
|
|||
{
|
||||
"model_version": "ternary g128 (gemlite-int2 deployment for CUDA inference)",
|
||||
"total_bytes": 4547304490,
|
||||
"files": [
|
||||
{
|
||||
"remote_path": "model_index.json",
|
||||
"size": 81,
|
||||
"sha256": "ecb4735e37691a8733f62957fd6c548f841af40624905bb24fa639756153c8a1"
|
||||
},
|
||||
{
|
||||
"remote_path": "LICENSE",
|
||||
"size": 10174,
|
||||
"sha256": "69849221bfb90053de2134ef5e6d540287b4b98062326492f1f96f5da685524b"
|
||||
},
|
||||
{
|
||||
"remote_path": "NOTICE.md",
|
||||
"size": 623,
|
||||
"sha256": "bbefa4a26b836efc040c1a0f155a425d1d833eae1b2534ffc414b1eada3cd922"
|
||||
},
|
||||
{
|
||||
"remote_path": "README.md",
|
||||
"size": 13033,
|
||||
"sha256": "742dbbcc4ecb979e11f8377bdadfb312a2b1437c5b4950d7a3fb155f71c82f20"
|
||||
},
|
||||
{
|
||||
"remote_path": "text_encoder-hqq-4bit/config.json",
|
||||
"size": 1535,
|
||||
"sha256": "979b4d6b42dfae3c6dece91da5fe139926dee4a1a244a1cf129d2025c2a60064"
|
||||
},
|
||||
{
|
||||
"remote_path": "text_encoder-hqq-4bit/qmodel.pt",
|
||||
"size": 2822340711,
|
||||
"sha256": "57ecb803e88313f896b24f2f6fedddcb2966c174801f8d89115f4fbae99be48a"
|
||||
},
|
||||
{
|
||||
"remote_path": "text_encoder-hqq-4bit/tokenizer/added_tokens.json",
|
||||
"size": 707,
|
||||
"sha256": "c0284b582e14987fbd3d5a2cb2bd139084371ed9acbae488829a1c900833c680"
|
||||
},
|
||||
{
|
||||
"remote_path": "text_encoder-hqq-4bit/tokenizer/chat_template.jinja",
|
||||
"size": 4168,
|
||||
"sha256": "a55ee1b1660128b7098723e0abcd92caa0788061051c62d51cbe87d9cf1974d8"
|
||||
},
|
||||
{
|
||||
"remote_path": "text_encoder-hqq-4bit/tokenizer/merges.txt",
|
||||
"size": 1671853,
|
||||
"sha256": "8831e4f1a044471340f7c0a83d7bd71306a5b867e95fd870f74d0c5308a904d5"
|
||||
},
|
||||
{
|
||||
"remote_path": "text_encoder-hqq-4bit/tokenizer/special_tokens_map.json",
|
||||
"size": 613,
|
||||
"sha256": "76862e765266b85aa9459767e33cbaf13970f327a0e88d1c65846c2ddd3a1ecd"
|
||||
},
|
||||
{
|
||||
"remote_path": "text_encoder-hqq-4bit/tokenizer/tokenizer.json",
|
||||
"size": 11422654,
|
||||
"sha256": "aeb13307a71acd8fe81861d94ad54ab689df773318809eed3cbe794b4492dae4"
|
||||
},
|
||||
{
|
||||
"remote_path": "text_encoder-hqq-4bit/tokenizer/tokenizer_config.json",
|
||||
"size": 5404,
|
||||
"sha256": "443bfa629eb16387a12edbf92a76f6a6f10b2af3b53d87ba1550adfcf45f7fa0"
|
||||
},
|
||||
{
|
||||
"remote_path": "text_encoder-hqq-4bit/tokenizer/vocab.json",
|
||||
"size": 2776833,
|
||||
"sha256": "ca10d7e9fb3ed18575dd1e277a2579c16d108e32f27439684afa0e10b1440910"
|
||||
},
|
||||
{
|
||||
"remote_path": "transformer-gemlite-int2/config.json",
|
||||
"size": 620,
|
||||
"sha256": "f4c11e406efb84b36ada1a4287423d4aff2092d74bf15774455f88a7e4888a02"
|
||||
},
|
||||
{
|
||||
"remote_path": "transformer-gemlite-int2/gemlite_autotune.json",
|
||||
"size": 470215,
|
||||
"sha256": "6847ecb93765973c0f4c28baee6f265dc66405be3401d1fd5b28496c0aeb0037"
|
||||
},
|
||||
{
|
||||
"remote_path": "transformer-gemlite-int2/quantization_config.json",
|
||||
"size": 6042,
|
||||
"sha256": "889c48a7f55a1630ec97ea5e050fd81df32c8a4a31c44434377a44f449a471fa"
|
||||
},
|
||||
{
|
||||
"remote_path": "transformer-gemlite-int2/state_dict.pt",
|
||||
"size": 1540457482,
|
||||
"sha256": "a3a7df8a90374fea24afce3b36f00b4c728d0254717143d61f912a7b3070e7ac"
|
||||
},
|
||||
{
|
||||
"remote_path": "vae/config.json",
|
||||
"size": 864,
|
||||
"sha256": "a1cb2ba54a569913eca375d9ee3afe683ba680bd9f64a49d86ec2bd14f304409"
|
||||
},
|
||||
{
|
||||
"remote_path": "vae/diffusion_pytorch_model.safetensors",
|
||||
"size": 168120878,
|
||||
"sha256": "ca70d2202afe6415bdbcb8793ba8cd99fd159cfe6192381504d6c4d3036e0f04"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"_class_name": "Flux2KleinPipeline",
|
||||
"_diffusers_version": "0.37.0.dev0"
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
{
|
||||
"architectures": [
|
||||
"Qwen3ForCausalLM"
|
||||
],
|
||||
"attention_bias": false,
|
||||
"attention_dropout": 0.0,
|
||||
"bos_token_id": 151643,
|
||||
"dtype": "float16",
|
||||
"eos_token_id": 151645,
|
||||
"head_dim": 128,
|
||||
"hidden_act": "silu",
|
||||
"hidden_size": 2560,
|
||||
"initializer_range": 0.02,
|
||||
"intermediate_size": 9728,
|
||||
"layer_types": [
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention"
|
||||
],
|
||||
"max_position_embeddings": 40960,
|
||||
"max_window_layers": 36,
|
||||
"model_type": "qwen3",
|
||||
"num_attention_heads": 32,
|
||||
"num_hidden_layers": 36,
|
||||
"num_key_value_heads": 8,
|
||||
"rms_norm_eps": 1e-06,
|
||||
"rope_scaling": null,
|
||||
"rope_theta": 1000000,
|
||||
"sliding_window": null,
|
||||
"tie_word_embeddings": true,
|
||||
"transformers_version": "4.57.6",
|
||||
"use_cache": true,
|
||||
"use_sliding_window": false,
|
||||
"vocab_size": 151936
|
||||
}
|
||||
BIN
image/gemlite/prism-ml/bonsai-image-ternary-4B-gemlite-2bit/text_encoder-hqq-4bit/qmodel.pt
(Stored with Git LFS)
Normal file
BIN
image/gemlite/prism-ml/bonsai-image-ternary-4B-gemlite-2bit/text_encoder-hqq-4bit/qmodel.pt
(Stored with Git LFS)
Normal file
Binary file not shown.
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"</think>": 151668,
|
||||
"</tool_call>": 151658,
|
||||
"</tool_response>": 151666,
|
||||
"<think>": 151667,
|
||||
"<tool_call>": 151657,
|
||||
"<tool_response>": 151665,
|
||||
"<|box_end|>": 151649,
|
||||
"<|box_start|>": 151648,
|
||||
"<|endoftext|>": 151643,
|
||||
"<|file_sep|>": 151664,
|
||||
"<|fim_middle|>": 151660,
|
||||
"<|fim_pad|>": 151662,
|
||||
"<|fim_prefix|>": 151659,
|
||||
"<|fim_suffix|>": 151661,
|
||||
"<|im_end|>": 151645,
|
||||
"<|im_start|>": 151644,
|
||||
"<|image_pad|>": 151655,
|
||||
"<|object_ref_end|>": 151647,
|
||||
"<|object_ref_start|>": 151646,
|
||||
"<|quad_end|>": 151651,
|
||||
"<|quad_start|>": 151650,
|
||||
"<|repo_name|>": 151663,
|
||||
"<|video_pad|>": 151656,
|
||||
"<|vision_end|>": 151653,
|
||||
"<|vision_pad|>": 151654,
|
||||
"<|vision_start|>": 151652
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
{%- if tools %}
|
||||
{{- '<|im_start|>system\n' }}
|
||||
{%- if messages[0].role == 'system' %}
|
||||
{{- messages[0].content + '\n\n' }}
|
||||
{%- endif %}
|
||||
{{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
|
||||
{%- for tool in tools %}
|
||||
{{- "\n" }}
|
||||
{{- tool | tojson }}
|
||||
{%- endfor %}
|
||||
{{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
|
||||
{%- else %}
|
||||
{%- if messages[0].role == 'system' %}
|
||||
{{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
|
||||
{%- for message in messages[::-1] %}
|
||||
{%- set index = (messages|length - 1) - loop.index0 %}
|
||||
{%- if ns.multi_step_tool and message.role == "user" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
|
||||
{%- set ns.multi_step_tool = false %}
|
||||
{%- set ns.last_query_index = index %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- for message in messages %}
|
||||
{%- if message.content is string %}
|
||||
{%- set content = message.content %}
|
||||
{%- else %}
|
||||
{%- set content = '' %}
|
||||
{%- endif %}
|
||||
{%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
|
||||
{{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
|
||||
{%- elif message.role == "assistant" %}
|
||||
{%- set reasoning_content = '' %}
|
||||
{%- if message.reasoning_content is string %}
|
||||
{%- set reasoning_content = message.reasoning_content %}
|
||||
{%- else %}
|
||||
{%- if '</think>' in content %}
|
||||
{%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
|
||||
{%- set content = content.split('</think>')[-1].lstrip('\n') %}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- if loop.index0 > ns.last_query_index %}
|
||||
{%- if loop.last or (not loop.last and reasoning_content) %}
|
||||
{{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
|
||||
{%- else %}
|
||||
{{- '<|im_start|>' + message.role + '\n' + content }}
|
||||
{%- endif %}
|
||||
{%- else %}
|
||||
{{- '<|im_start|>' + message.role + '\n' + content }}
|
||||
{%- endif %}
|
||||
{%- if message.tool_calls %}
|
||||
{%- for tool_call in message.tool_calls %}
|
||||
{%- if (loop.first and content) or (not loop.first) %}
|
||||
{{- '\n' }}
|
||||
{%- endif %}
|
||||
{%- if tool_call.function %}
|
||||
{%- set tool_call = tool_call.function %}
|
||||
{%- endif %}
|
||||
{{- '<tool_call>\n{"name": "' }}
|
||||
{{- tool_call.name }}
|
||||
{{- '", "arguments": ' }}
|
||||
{%- if tool_call.arguments is string %}
|
||||
{{- tool_call.arguments }}
|
||||
{%- else %}
|
||||
{{- tool_call.arguments | tojson }}
|
||||
{%- endif %}
|
||||
{{- '}\n</tool_call>' }}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{{- '<|im_end|>\n' }}
|
||||
{%- elif message.role == "tool" %}
|
||||
{%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
|
||||
{{- '<|im_start|>user' }}
|
||||
{%- endif %}
|
||||
{{- '\n<tool_response>\n' }}
|
||||
{{- content }}
|
||||
{{- '\n</tool_response>' }}
|
||||
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
|
||||
{{- '<|im_end|>\n' }}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- if add_generation_prompt %}
|
||||
{{- '<|im_start|>assistant\n' }}
|
||||
{%- if enable_thinking is defined and enable_thinking is false %}
|
||||
{{- '<think>\n\n</think>\n\n' }}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
BIN
image/gemlite/prism-ml/bonsai-image-ternary-4B-gemlite-2bit/text_encoder-hqq-4bit/tokenizer/merges.txt
(Stored with Git LFS)
Normal file
BIN
image/gemlite/prism-ml/bonsai-image-ternary-4B-gemlite-2bit/text_encoder-hqq-4bit/tokenizer/merges.txt
(Stored with Git LFS)
Normal file
Binary file not shown.
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"additional_special_tokens": [
|
||||
"<|im_start|>",
|
||||
"<|im_end|>",
|
||||
"<|object_ref_start|>",
|
||||
"<|object_ref_end|>",
|
||||
"<|box_start|>",
|
||||
"<|box_end|>",
|
||||
"<|quad_start|>",
|
||||
"<|quad_end|>",
|
||||
"<|vision_start|>",
|
||||
"<|vision_end|>",
|
||||
"<|vision_pad|>",
|
||||
"<|image_pad|>",
|
||||
"<|video_pad|>"
|
||||
],
|
||||
"eos_token": {
|
||||
"content": "<|im_end|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
},
|
||||
"pad_token": {
|
||||
"content": "<|endoftext|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
}
|
||||
}
|
||||
BIN
image/gemlite/prism-ml/bonsai-image-ternary-4B-gemlite-2bit/text_encoder-hqq-4bit/tokenizer/tokenizer.json
(Stored with Git LFS)
Normal file
BIN
image/gemlite/prism-ml/bonsai-image-ternary-4B-gemlite-2bit/text_encoder-hqq-4bit/tokenizer/tokenizer.json
(Stored with Git LFS)
Normal file
Binary file not shown.
|
|
@ -0,0 +1,239 @@
|
|||
{
|
||||
"add_bos_token": false,
|
||||
"add_prefix_space": false,
|
||||
"added_tokens_decoder": {
|
||||
"151643": {
|
||||
"content": "<|endoftext|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151644": {
|
||||
"content": "<|im_start|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151645": {
|
||||
"content": "<|im_end|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151646": {
|
||||
"content": "<|object_ref_start|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151647": {
|
||||
"content": "<|object_ref_end|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151648": {
|
||||
"content": "<|box_start|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151649": {
|
||||
"content": "<|box_end|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151650": {
|
||||
"content": "<|quad_start|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151651": {
|
||||
"content": "<|quad_end|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151652": {
|
||||
"content": "<|vision_start|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151653": {
|
||||
"content": "<|vision_end|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151654": {
|
||||
"content": "<|vision_pad|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151655": {
|
||||
"content": "<|image_pad|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151656": {
|
||||
"content": "<|video_pad|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151657": {
|
||||
"content": "<tool_call>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
},
|
||||
"151658": {
|
||||
"content": "</tool_call>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
},
|
||||
"151659": {
|
||||
"content": "<|fim_prefix|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
},
|
||||
"151660": {
|
||||
"content": "<|fim_middle|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
},
|
||||
"151661": {
|
||||
"content": "<|fim_suffix|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
},
|
||||
"151662": {
|
||||
"content": "<|fim_pad|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
},
|
||||
"151663": {
|
||||
"content": "<|repo_name|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
},
|
||||
"151664": {
|
||||
"content": "<|file_sep|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
},
|
||||
"151665": {
|
||||
"content": "<tool_response>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
},
|
||||
"151666": {
|
||||
"content": "</tool_response>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
},
|
||||
"151667": {
|
||||
"content": "<think>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
},
|
||||
"151668": {
|
||||
"content": "</think>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
}
|
||||
},
|
||||
"additional_special_tokens": [
|
||||
"<|im_start|>",
|
||||
"<|im_end|>",
|
||||
"<|object_ref_start|>",
|
||||
"<|object_ref_end|>",
|
||||
"<|box_start|>",
|
||||
"<|box_end|>",
|
||||
"<|quad_start|>",
|
||||
"<|quad_end|>",
|
||||
"<|vision_start|>",
|
||||
"<|vision_end|>",
|
||||
"<|vision_pad|>",
|
||||
"<|image_pad|>",
|
||||
"<|video_pad|>"
|
||||
],
|
||||
"bos_token": null,
|
||||
"clean_up_tokenization_spaces": false,
|
||||
"eos_token": "<|im_end|>",
|
||||
"errors": "replace",
|
||||
"extra_special_tokens": {},
|
||||
"model_max_length": 131072,
|
||||
"pad_token": "<|endoftext|>",
|
||||
"split_special_tokens": false,
|
||||
"tokenizer_class": "Qwen2Tokenizer",
|
||||
"unk_token": null
|
||||
}
|
||||
BIN
image/gemlite/prism-ml/bonsai-image-ternary-4B-gemlite-2bit/text_encoder-hqq-4bit/tokenizer/vocab.json
(Stored with Git LFS)
Normal file
BIN
image/gemlite/prism-ml/bonsai-image-ternary-4B-gemlite-2bit/text_encoder-hqq-4bit/tokenizer/vocab.json
(Stored with Git LFS)
Normal file
Binary file not shown.
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"_class_name": "Flux2Transformer2DModel",
|
||||
"_diffusers_version": "0.37.1",
|
||||
"_name_or_path": "black-forest-labs/FLUX.2-klein-4B",
|
||||
"attention_head_dim": 128,
|
||||
"axes_dims_rope": [
|
||||
32,
|
||||
32,
|
||||
32,
|
||||
32
|
||||
],
|
||||
"enable_time_sign_embed": false,
|
||||
"eps": 1e-06,
|
||||
"guidance_embeds": false,
|
||||
"in_channels": 128,
|
||||
"joint_attention_dim": 7680,
|
||||
"mlp_ratio": 3.0,
|
||||
"musubi_block_swap_device": "cpu",
|
||||
"musubi_blocks_to_swap": 0,
|
||||
"num_attention_heads": 24,
|
||||
"num_layers": 5,
|
||||
"num_single_layers": 20,
|
||||
"out_channels": null,
|
||||
"patch_size": 1,
|
||||
"rope_theta": 2000,
|
||||
"timestep_guidance_channels": 256
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,163 @@
|
|||
{
|
||||
"format": "gemlite-int2-ternary-g128",
|
||||
"bits": 2,
|
||||
"group_size": 128,
|
||||
"packing_bitwidth": 8,
|
||||
"solver": "ternary",
|
||||
"input_dtype": "fp16",
|
||||
"output_dtype": "fp16",
|
||||
"skip_patterns": [
|
||||
"proj_out",
|
||||
"x_embedder",
|
||||
"context_embedder",
|
||||
"time_text_embed",
|
||||
"time_guidance_embed",
|
||||
"norm_out",
|
||||
"double_stream_modulation_img",
|
||||
"double_stream_modulation_txt",
|
||||
"single_stream_modulation"
|
||||
],
|
||||
"quantized_count": 100,
|
||||
"skipped_count": 9,
|
||||
"quantized_fqns": [
|
||||
"transformer_blocks.0.attn.to_q",
|
||||
"transformer_blocks.0.attn.to_k",
|
||||
"transformer_blocks.0.attn.to_v",
|
||||
"transformer_blocks.0.attn.add_q_proj",
|
||||
"transformer_blocks.0.attn.add_k_proj",
|
||||
"transformer_blocks.0.attn.add_v_proj",
|
||||
"transformer_blocks.0.attn.to_add_out",
|
||||
"transformer_blocks.0.attn.to_out.0",
|
||||
"transformer_blocks.0.ff.linear_in",
|
||||
"transformer_blocks.0.ff.linear_out",
|
||||
"transformer_blocks.0.ff_context.linear_in",
|
||||
"transformer_blocks.0.ff_context.linear_out",
|
||||
"transformer_blocks.1.attn.to_q",
|
||||
"transformer_blocks.1.attn.to_k",
|
||||
"transformer_blocks.1.attn.to_v",
|
||||
"transformer_blocks.1.attn.add_q_proj",
|
||||
"transformer_blocks.1.attn.add_k_proj",
|
||||
"transformer_blocks.1.attn.add_v_proj",
|
||||
"transformer_blocks.1.attn.to_add_out",
|
||||
"transformer_blocks.1.attn.to_out.0",
|
||||
"transformer_blocks.1.ff.linear_in",
|
||||
"transformer_blocks.1.ff.linear_out",
|
||||
"transformer_blocks.1.ff_context.linear_in",
|
||||
"transformer_blocks.1.ff_context.linear_out",
|
||||
"transformer_blocks.2.attn.to_q",
|
||||
"transformer_blocks.2.attn.to_k",
|
||||
"transformer_blocks.2.attn.to_v",
|
||||
"transformer_blocks.2.attn.add_q_proj",
|
||||
"transformer_blocks.2.attn.add_k_proj",
|
||||
"transformer_blocks.2.attn.add_v_proj",
|
||||
"transformer_blocks.2.attn.to_add_out",
|
||||
"transformer_blocks.2.attn.to_out.0",
|
||||
"transformer_blocks.2.ff.linear_in",
|
||||
"transformer_blocks.2.ff.linear_out",
|
||||
"transformer_blocks.2.ff_context.linear_in",
|
||||
"transformer_blocks.2.ff_context.linear_out",
|
||||
"transformer_blocks.3.attn.to_q",
|
||||
"transformer_blocks.3.attn.to_k",
|
||||
"transformer_blocks.3.attn.to_v",
|
||||
"transformer_blocks.3.attn.add_q_proj",
|
||||
"transformer_blocks.3.attn.add_k_proj",
|
||||
"transformer_blocks.3.attn.add_v_proj",
|
||||
"transformer_blocks.3.attn.to_add_out",
|
||||
"transformer_blocks.3.attn.to_out.0",
|
||||
"transformer_blocks.3.ff.linear_in",
|
||||
"transformer_blocks.3.ff.linear_out",
|
||||
"transformer_blocks.3.ff_context.linear_in",
|
||||
"transformer_blocks.3.ff_context.linear_out",
|
||||
"transformer_blocks.4.attn.to_q",
|
||||
"transformer_blocks.4.attn.to_k",
|
||||
"transformer_blocks.4.attn.to_v",
|
||||
"transformer_blocks.4.attn.add_q_proj",
|
||||
"transformer_blocks.4.attn.add_k_proj",
|
||||
"transformer_blocks.4.attn.add_v_proj",
|
||||
"transformer_blocks.4.attn.to_add_out",
|
||||
"transformer_blocks.4.attn.to_out.0",
|
||||
"transformer_blocks.4.ff.linear_in",
|
||||
"transformer_blocks.4.ff.linear_out",
|
||||
"transformer_blocks.4.ff_context.linear_in",
|
||||
"transformer_blocks.4.ff_context.linear_out",
|
||||
"single_transformer_blocks.0.attn.to_qkv_mlp_proj",
|
||||
"single_transformer_blocks.0.attn.to_out",
|
||||
"single_transformer_blocks.1.attn.to_qkv_mlp_proj",
|
||||
"single_transformer_blocks.1.attn.to_out",
|
||||
"single_transformer_blocks.2.attn.to_qkv_mlp_proj",
|
||||
"single_transformer_blocks.2.attn.to_out",
|
||||
"single_transformer_blocks.3.attn.to_qkv_mlp_proj",
|
||||
"single_transformer_blocks.3.attn.to_out",
|
||||
"single_transformer_blocks.4.attn.to_qkv_mlp_proj",
|
||||
"single_transformer_blocks.4.attn.to_out",
|
||||
"single_transformer_blocks.5.attn.to_qkv_mlp_proj",
|
||||
"single_transformer_blocks.5.attn.to_out",
|
||||
"single_transformer_blocks.6.attn.to_qkv_mlp_proj",
|
||||
"single_transformer_blocks.6.attn.to_out",
|
||||
"single_transformer_blocks.7.attn.to_qkv_mlp_proj",
|
||||
"single_transformer_blocks.7.attn.to_out",
|
||||
"single_transformer_blocks.8.attn.to_qkv_mlp_proj",
|
||||
"single_transformer_blocks.8.attn.to_out",
|
||||
"single_transformer_blocks.9.attn.to_qkv_mlp_proj",
|
||||
"single_transformer_blocks.9.attn.to_out",
|
||||
"single_transformer_blocks.10.attn.to_qkv_mlp_proj",
|
||||
"single_transformer_blocks.10.attn.to_out",
|
||||
"single_transformer_blocks.11.attn.to_qkv_mlp_proj",
|
||||
"single_transformer_blocks.11.attn.to_out",
|
||||
"single_transformer_blocks.12.attn.to_qkv_mlp_proj",
|
||||
"single_transformer_blocks.12.attn.to_out",
|
||||
"single_transformer_blocks.13.attn.to_qkv_mlp_proj",
|
||||
"single_transformer_blocks.13.attn.to_out",
|
||||
"single_transformer_blocks.14.attn.to_qkv_mlp_proj",
|
||||
"single_transformer_blocks.14.attn.to_out",
|
||||
"single_transformer_blocks.15.attn.to_qkv_mlp_proj",
|
||||
"single_transformer_blocks.15.attn.to_out",
|
||||
"single_transformer_blocks.16.attn.to_qkv_mlp_proj",
|
||||
"single_transformer_blocks.16.attn.to_out",
|
||||
"single_transformer_blocks.17.attn.to_qkv_mlp_proj",
|
||||
"single_transformer_blocks.17.attn.to_out",
|
||||
"single_transformer_blocks.18.attn.to_qkv_mlp_proj",
|
||||
"single_transformer_blocks.18.attn.to_out",
|
||||
"single_transformer_blocks.19.attn.to_qkv_mlp_proj",
|
||||
"single_transformer_blocks.19.attn.to_out"
|
||||
],
|
||||
"skipped": [
|
||||
{
|
||||
"fqn": "x_embedder",
|
||||
"reason": "x_embedder"
|
||||
},
|
||||
{
|
||||
"fqn": "context_embedder",
|
||||
"reason": "context_embedder"
|
||||
},
|
||||
{
|
||||
"fqn": "proj_out",
|
||||
"reason": "proj_out"
|
||||
},
|
||||
{
|
||||
"fqn": "time_guidance_embed.timestep_embedder.linear_1",
|
||||
"reason": "time_guidance_embed"
|
||||
},
|
||||
{
|
||||
"fqn": "time_guidance_embed.timestep_embedder.linear_2",
|
||||
"reason": "time_guidance_embed"
|
||||
},
|
||||
{
|
||||
"fqn": "double_stream_modulation_img.linear",
|
||||
"reason": "double_stream_modulation_img"
|
||||
},
|
||||
{
|
||||
"fqn": "double_stream_modulation_txt.linear",
|
||||
"reason": "double_stream_modulation_txt"
|
||||
},
|
||||
{
|
||||
"fqn": "single_stream_modulation.linear",
|
||||
"reason": "single_stream_modulation"
|
||||
},
|
||||
{
|
||||
"fqn": "norm_out.linear",
|
||||
"reason": "norm_out"
|
||||
}
|
||||
],
|
||||
"pack_seconds": 150.48
|
||||
}
|
||||
BIN
image/gemlite/prism-ml/bonsai-image-ternary-4B-gemlite-2bit/transformer-gemlite-int2/state_dict.pt
(Stored with Git LFS)
Normal file
BIN
image/gemlite/prism-ml/bonsai-image-ternary-4B-gemlite-2bit/transformer-gemlite-int2/state_dict.pt
(Stored with Git LFS)
Normal file
Binary file not shown.
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"_class_name": "AutoencoderKLFlux2",
|
||||
"_diffusers_version": "0.37.1",
|
||||
"_name_or_path": "black-forest-labs/FLUX.2-klein-base-4B",
|
||||
"act_fn": "silu",
|
||||
"batch_norm_eps": 0.0001,
|
||||
"batch_norm_momentum": 0.1,
|
||||
"block_out_channels": [
|
||||
128,
|
||||
256,
|
||||
512,
|
||||
512
|
||||
],
|
||||
"decoder_block_out_channels": null,
|
||||
"down_block_types": [
|
||||
"DownEncoderBlock2D",
|
||||
"DownEncoderBlock2D",
|
||||
"DownEncoderBlock2D",
|
||||
"DownEncoderBlock2D"
|
||||
],
|
||||
"force_upcast": true,
|
||||
"in_channels": 3,
|
||||
"latent_channels": 32,
|
||||
"layers_per_block": 2,
|
||||
"mid_block_add_attention": true,
|
||||
"norm_num_groups": 32,
|
||||
"out_channels": 3,
|
||||
"patch_size": [
|
||||
2,
|
||||
2
|
||||
],
|
||||
"sample_size": 1024,
|
||||
"up_block_types": [
|
||||
"UpDecoderBlock2D",
|
||||
"UpDecoderBlock2D",
|
||||
"UpDecoderBlock2D",
|
||||
"UpDecoderBlock2D"
|
||||
],
|
||||
"use_post_quant_conv": true,
|
||||
"use_quant_conv": true
|
||||
}
|
||||
BIN
image/gemlite/prism-ml/bonsai-image-ternary-4B-gemlite-2bit/vae/diffusion_pytorch_model.safetensors
(Stored with Git LFS)
Normal file
BIN
image/gemlite/prism-ml/bonsai-image-ternary-4B-gemlite-2bit/vae/diffusion_pytorch_model.safetensors
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue