Dupe-R-IMG / README.md
shimbaaa's picture
Dupe-R-IMG: merge DiT + T5 encoder + VAE (297.5M)
617093a verified
|
Raw History Blame Contribute Delete
3.51 kB
---
license: apache-2.0
library_name: transformers
pipeline_tag: text-to-image
tags:
- image
- text-to-image
- duper
- dit
- rectified-flow
---
# Dupe-R-IMG
The **Supra2-IMG** denoiser, the **flan-t5-base** encoder and the **sd-vae-ft-mse** VAE
packed into one `model.safetensors`
| section | params | source | license |
|---|---|---|---|
| `dit.*` | 104,193,168 | [SupraLabs/Supra2-IMG](https://huggingface.co/SupraLabs/Supra2-IMG) | apache-2.0 |
| `text_encoder.*` | 109,628,544 | [google/flan-t5-base](https://huggingface.co/google/flan-t5-base) | apache-2.0 |
| `vae.*` | 83,653,863 | [stabilityai/sd-vae-ft-mse](https://huggingface.co/stabilityai/sd-vae-ft-mse) | mit |
| **total** | **297,475,575** | | |
## What this is
A **repackaging, not a weight blend**. The DiT was trained against exactly these two
encoders, so averaging anything would break it. Every tensor is copied unmodified and
re-namespaced:
- `dit.*` — SupraDiT denoiser, 14 blocks, d_model 576, patch 2
- `text_encoder.*` — T5 encoder stack, `shared.weight` token embedding included
- `vae.*` — full AutoencoderKL
Not bundled: the T5 `decoder.*` stack (113M) and `lm_head.weight` (24.7M). Text-to-image
never runs the seq2seq half.
## Files
| file | size | what |
|---|---|---|
| `model.safetensors` | ~567 MB | all 297,475,575 params, prefixed `dit.` / `text_encoder.` / `vae.` |
| `supra2img.himg` | supra2img converted to .himg ~417 MB | `mmap` `PROT_READ`, zero-copy load |
| `model_final_ema.pt` | ~416 MB | untouched upstream checkpoint (bf16) |
| `config.json` | | geometry, per-section param counts, component provenance |
| `vae_config.json` | | native `AutoencoderKL` config (separate name on purpose) |
| `tokenizer.json`, `spiece.model`, … | | flan-t5 tokenizer |
Prefer `.himg` when memory is tight: so a 417 MB model
costs no resident RAM. `model.safetensors` is the portable single-file form.
## Precision
Stored `float16`, **compute `float32`** (upcast on load). Storage-only: a build comparing
the C core against a PyTorch reference from this same file still agrees at 1e-6, since
both read identical bytes. Only parity against the original upstream checkpoint moves
(~1e-3), which is not visible in a pixel. The `.himg` is exact float32 if you need bit
parity.
## Specs
| | |
|---|---|
| resolution | 256x256 |
| latent | 4 x 32 x 32 |
| context | 128 tokens (flan-t5-base) |
| sampler | rectified flow, Euler (Heun supported) |
| default steps / cfg | 50 / 3.0 |
| latent scale | 0.18215 |
## Usage
```python
import json
from huggingface_hub import hf_hub_download
from safetensors import safe_open
from diffusers import AutoencoderKL
repo = "ShimbaLLM/Dupe-R-IMG"
dit_sd, te_sd, vae_sd = {}, {}, {}
with safe_open(hf_hub_download(repo, "model.safetensors"), framework="pt") as f:
for k in f.keys():
(dit_sd if k.startswith("dit.") else
te_sd if k.startswith("text_encoder.") else
vae_sd)[k.split('.', 1)[1]] = f.get_tensor(k).float()
vae = AutoencoderKL.from_config(
json.load(open(hf_hub_download(repo, "vae_config.json"))))
vae.load_state_dict(vae_sd)
```
The T5 encoder stack and the SupraDiT module definitions are in `config.json` under
`components`, and in the notebook that produced this release.
## Licenses
Bundled components keep their own licenses and carry independent provenance in
`config.json`: DiT apache-2.0 (SupraLabs), T5 encoder apache-2.0 (Google), VAE mit
(Stability AI). All three permit redistribution, individually and combined.