Downloads · 30 days
6
7% of all-time downloads
gabe-engineers/bonsai-image-ternary-4B-gemlite-2bit-unpacked-encoder
bonsai-image-ternary-4B-gemlite-2bit-unpacked-encoder is a text-to-image model from gabe-engineers. Use it when you need an image from a text prompt. It is set up for diffusers. The card lists the license as apache-2.0.
A Diffusers-compatible variant of Prism ML's Bonsai Image Ternary 4B GemLite release.
Downloads · 30 days
6
7% of all-time downloads
All-time downloads
86
Public
Parameters
1.2B
12.6 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors9.8 GB · 100%
How the weights are stored.
U8920M · 78%
From the Hugging Face model README
A Diffusers-compatible variant of Prism ML's Bonsai Image Ternary 4B GemLite release.
This repository preserves the ternary GemLite-packed diffusion transformer, while replacing the original HQQ-packed text encoder with an unpacked, non-HQQ encoder.
The purpose of this variant is to provide a complete pipeline that demonstrates native loading of pre-quantized GemLite checkpoints through the standard Diffusers interface introduced in huggingface/diffusers#14286.
This is primarily a compatibility and integration checkpoint. For the most memory-efficient complete Bonsai Image package, use the original Prism ML release.
| Component | Format |
|---|---|
| Diffusion transformer | Ternary weights packed in GemLite's 2-bit representation |
| Text encoder | Unpacked, non-HQQ weights |
| VAE | Standard pipeline weights |
The transformer retains ternary values from the original model and executes its supported linear layers directly through GemLite kernels. The packed transformer weights are not expanded back to full precision during loading.
The text encoder is intentionally unpacked because loading the original HQQ-packed encoder is outside the scope of the current Diffusers GemLite integration.
The original Bonsai Image CUDA package combines:
The Diffusers integration in PR #14286 adds support for loading the GemLite portion of that package through the standard Diffusers quantization interface. It does not add HQQ checkpoint loading.
This variant therefore uses:
This allows the complete pipeline to be loaded with:
DiffusionPipeline.from_pretrained(...)
without custom model-loading code.
Native GemLite checkpoint loading is currently proposed in:
Until that PR is merged and included in a Diffusers release, install Diffusers from the PR author's branch.
The API and installation instructions may change during upstream review.
gemlite>=0.6.0GemLite execution is not supported on CPU or Apple MPS.
pip install -U \
"git+https://github.com/gabe-engineers/diffusers.git@add-gemlite-quantizer" \
"gemlite>=0.6.0" \
transformers \
accelerate \
safetensors
pip install -U \
diffusers \
"gemlite>=0.6.0" \
transformers \
accelerate \
safetensors
import torch
from diffusers import DiffusionPipeline
model_id = (
"gabe-engineers/"
"bonsai-image-ternary-4B-gemlite-2bit-unpacked-encoder"
)
pipe = DiffusionPipeline.from_pretrained(
model_id,
dtype=torch.float16,
device_map="cuda",
)
image = pipe(
prompt="A bonsai tree in a quiet ceramic studio, soft morning light",
height=1024,
width=1024,
num_inference_steps=4,
guidance_scale=1.0,
).images[0]
image.save("bonsai-gemlite.png")
No explicit GemLiteConfig is required when loading this repository. The serialized GemLite quantization configuration is stored with the transformer checkpoint and is detected automatically by Diffusers.
The dtype passed to from_pretrained must match the compute_dtype stored in the GemLite quantization configuration.
This checkpoint uses:
dtype=torch.float16
Passing a different dtype will raise an error rather than silently loading the pipeline with an incompatible configuration.
This repository is derived from:
The main difference is the text encoder:
| Repository | Transformer | Text encoder |
|---|---|---|
| Original Prism ML release | GemLite-packed ternary | HQQ-packed |
| This repository | GemLite-packed ternary | Unpacked and non-HQQ |
Because the encoder is unpacked, this repository has a larger total storage and memory footprint than the fully compressed original release.
The transformer itself remains GemLite-packed and retains the primary purpose of this checkpoint: validating native low-bit GemLite loading in Diffusers.
This repository is intended for:
The model architecture and trained weights originate from the Bonsai Image releases by Prism ML.
Relevant upstream repositories:
This repository does not claim authorship of the underlying Bonsai Image model. Its changes are limited to checkpoint composition, repository layout, serialized quantization metadata, and compatibility with the proposed Diffusers GemLite loader.
GemLite provides Triton kernels and packed representations for low-bit matrix operations.
The Diffusers integration replaces eligible torch.nn.Linear modules with GemLite linear modules before loading the checkpoint. The packed weights, scales, zero points, metadata, and original tensor shapes are then restored directly from the serialized checkpoint.
Implementation and discussion:
The integration is scoped to:
HQQ encoder support is intentionally treated as a separate integration concern.
This repository is distributed under the Apache License 2.0.
Refer to the included LICENSE and NOTICE.md files and the upstream model repositories for complete attribution and licensing information.