Run this model with HF Jobs
Run vladmandic/MicroDecoder on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/vladmandic/MicroDecoder. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/vladmandic/MicroDecoder on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use vladmandic/MicroDecoder with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use vladmandic/MicroDecoder with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("vladmandic/MicroDecoder", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
Commit Β·
ad7a32e
1
Parent(s): 9652e76
update
Browse filesSigned-off-by: Vladimir Mandic <mandic00@live.com>
Files changed (2)
- README.md+30-18
- microdecoder-minimaxh3.safetensorsAdded+3
5 unmodified lines6789101112131415161718192021222324259 unmodified lines3536373839404142434445464748495051525 unmodified lines# MicroDecoder**Micro-VAE** that can be trained on *any* diffusion model in **~15min** and provides low-quality reconstruction from latents to RGB in **~0.01sec**.Inference includes noise correction based on current timestep, intentional blurring plus upscale interpolation: all with intention of providing as fast-as-possible reconstruction that is viable and consistent with any noise levels.Intended use-case is live-preview during generative model inference.Shapes/Channels/etc are inferred from the base VAE, so no configuration changes are needed between different models.- Model definition and training code [here](https://github.com/vladmandic/sdnext/blob/dev/modules/vae/sd_vae_micro_train.py)- Example inference code [here](https://github.com/vladmandic/sdnext/blob/dev/modules/vae/sd_vae_micro.py)Example using **MicroDecoder** with `Flux.2-Klein-9B` and compared with official final VAE processing at the end:## Example```shellsd_vae_micro_train.py \9 unmodified lines``````logEncoding Latents: 100%Training MicroDecoder [350 epochs | Channels: 32 | Hidden: 256 | Scale: 4x]Dataset: 360 train samples | 40 validation samples | EMA decay: 0.999Epoch | Train Tot | Tr PSNR | Tr SSIM | Val Tot | Val PSNR | Val SSIM | Val L1 | Val LAB--------------------------------------------------------------------------------------------001/350 | 5.7244 | 10.38 | 0.3431 | 5.9729 | 10.56 | 0.3047 | 0.2676 | 0.4254 *100/350 | 2.7690 | 25.49 | 0.8030 | 2.2011 | 26.52 | 0.8672 | 0.0376 | 0.0699 *200/350 | 2.4006 | 27.04 | 0.8400 | 1.1679 | 34.24 | 0.9635 | 0.0132 | 0.0317 *300/350 | 2.3950 | 28.05 | 0.8472 | 1.0002 | 35.63 | 0.9723 | 0.0113 | 0.0282 *350/350 | 2.3010 | 28.51 | 0.8511 | 0.9781 | 35.83 | 0.9734 | 0.0111 | 0.0278 *Training complete! Best validation PSNR: 35.83 dB (Epoch 350)Saved best EMA model weights to: MicroVAE-qwen21.safetensors```5 unmodified lines6789101112131415161718192021222324252627282930313233343536379 unmodified lines4748495051525354555657585960616263645 unmodified lines# MicroDecoder**MicroDecoder** VAE can be trained on *any* diffusion model in **~15min** and provides low-quality reconstruction from latents to RGB in **~0.01sec**.Inference includes noise correction based on current timestep, blurring corrections plus upscale interpolation: all with intention of providing as fast-as-possible reconstruction that is viable and consistent with any noise levels.Intended use-case is live-preview during generative model inference.Shapes/Channels/etc are inferred from the base VAE, so no configuration changes are needed between different models.## ModelsModels included in this repo are pre-trained for following architectures:- **SD, SDXL, Flux.1, Flux.2, Qwen, Qwen-21, Wan-21, MiniMax-H3**## Code- Model definition [here](https://github.com/vladmandic/sdnext/blob/dev/modules/vae/sd_vae_micro_model.py)- Training code [here](https://github.com/vladmandic/sdnext/blob/dev/modules/vae/sd_vae_micro_train.py)- Example inference code [here](https://github.com/vladmandic/sdnext/blob/dev/modules/vae/sd_vae_micro.py)## ExampleExample using **MicroDecoder** with `Flux.2-Klein-9B` and compared with official final VAE processing at the end:## Training```shellsd_vae_micro_train.py \9 unmodified lines``````logMicroDecoder TrainArgs: Namespace(folder='/home/vlado/generative/Input/vae/', max=500, resolution=512, crop='center', vae='AutoencoderKLMiniMaxH3', repo='OzzyGT/MiniMax_H3_sdnq_dynamic_4bit', subfolder='vae', dim=256, epochs=400, scale=4, batch=16, lr=0.0003, ema=0.999, val=0.1, output='microdecoder-minimaxh3.safetensors', device='cuda')Base VAE: cls=<class 'diffusers.models.autoencoders.autoencoder_kl_minimax_h3.AutoencoderKLMiniMaxH3'> repo="OzzyGT/MiniMax_H3_sdnq_dynamic_4bit" subfolder="vae"Init VAE: model=MicroDecoder ema=EMAModel optimizer=AdamW scheduler=CosineAnnealingLR criterion=EnhancedQualityLoss metrics=DetailedMetricsTrackerEpoch | tTotal | tPSNR | tSSIM | vTotal | vPSNR | vSSIM | vL1 | vLAB-------------------------------------------------------------------------------------------001/400 | 7.0891 | 10.49 | 0.2540 | 7.1642 | 10.75 | 0.2357 | 0.2614 | 0.4146...400/400 | 4.5365 | 21.03 | 0.6402 | 1.9644 | 30.61 | 0.9266 | 0.0204 | 0.0465Load ββββββββββββββββββββ 400/400 100% 0:00:00 0:00:08 Images=400 Shape=torch.Size([400, 3, 512, 512])Encode ββββββββββββββββββββ 400/400 100% 0:00:00 0:00:46 Train=360 Validation=40 EMA=0.999Train ββββββββββββββββββββ 400/400 100% 0:00:00 0:06:33 Train(psnr=21.029 ssim=0.640 lpips=2.784 l1=0.089 lab=0.156 grad=0.073 sat=0.124 fft=0.071 total=4.536) Validate(psnr=30.607 ssim=0.927 lpips=1.242 l1=0.020 lab=0.046 grad=0.046 sat=0.057 fft=0.032 total=1.964)Complete: Time=393.89 Epoch/Sec=1.02 PSNR=30.61 dB @ Epoch=400Save: filename="microdecoder-minimaxh3.safetensors"```
123version https://git-lfs.github.com/spec/v1oid sha256:eb9427a1d8f92bdd123feda388f9865738095689df0a395eb49956bcd3b0415dsize 9713494README.md+30-18
microdecoder-minimaxh3.safetensorsAdded+3