Instructions to use ostris/primal_vae with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use ostris/primal_vae with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("ostris/primal_vae", 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
Single-file CMF build for local inference (Rust, GPU/CPU)
#1
by infosave - opened
We packaged both checkpoints as single CMF files that run with cortiq, a Rust inference engine with no Python: the whole encode or decode is one GPU submission on Vulkan/DX12 or Metal, or runs on the CPU.
Files: https://huggingface.co/infosave/primal_vae-cmf β primal_vae_2x2.cmf and primal_vae_2x1.cmf (161 MB each, 16-bit kernels; PSNR equal to the PyTorch float32 reference to 0.01 dB).
A 1024Γ1024 encode / decode takes 0.40 / 0.29 s on an NVIDIA A40 and 1.27 / 1.23 s on an Apple M4.
cargo install cortiq-cli
cortiq vae --model primal_vae_2x2.cmf --mode encode --input photo.png --output latent.npy
cortiq vae --model primal_vae_2x2.cmf --mode decode --input latent.npy --output image.png
(cortiq 0.8.51)