Skip to content
AI.info

The Pulse

Supra2-IMG Inference Script Defines a Compact 256px Latent-DiT

A Hugging Face inference script documents Supra2-IMG's architecture and local generation path, while leaving training history, licensing and benchmark claims outside the file's evidence.

Supra2-IMG Inference Script Defines a Compact 256px Latent-DiT

AI.info Team ·

The Hugging Face inference script for Supra2-IMG documents a compact text-to-image system built around a diffusion transformer, or DiT, operating in a compressed latent space. The file describes the model as a “~100M parameter DiT for rectified-flow text-to-image” and calculates the exact parameter count at runtime rather than stating a fixed total in the source.

The script sets the image size to 256 pixels and defines a 32×32 latent grid, reflecting the eightfold spatial compression used by the selected variational autoencoder. Latents have four channels and are processed with two-pixel patches. The transformer uses a model width of 576, 14 blocks and nine attention heads. These constants form the architecture that the script reconstructs before loading the checkpoint.

Text Conditioning and Image Decoding

Supra2-IMG uses Google's Flan-T5-Base as its text encoder. The script loads the tokenizer and encoder through Transformers, places the text model on the selected device and freezes its parameters for inference. The configured text dimension is 768, and the default context limit is 128 tokens. Prompts longer than the active context length are truncated after the script prints a warning.

Image decoding uses Stability AI's sd-vae-ft-mse model through Diffusers. The script scales the generated latent representation before decoding it, clamps the resulting image values and writes the output as a PNG with Torchvision. The default prompt asks for a sea jellyfish floating in the pitch-black ocean depths, and the default output filename is jellyfish.png.

Checkpoint Loading and Sampling

At startup, the program checks for a local file named model_final_ema.pt. If the file is absent, it uses the Hugging Face Hub client to download the checkpoint from the SupraLabs/Supra2-IMG repository. The model is instantiated in evaluation mode, its parameter count is computed and printed, and the checkpoint's exponential-moving-average weights are preferred when the saved state contains an ema entry.

Generation begins with random latent noise. Sampling uses Euler integration of a flow ordinary differential equation, with the number of steps controlled by a command-line argument. Classifier-free guidance is enabled when the guidance scale is greater than 1.0. The default settings are a seed of 0, a guidance scale of 3.0, 50 sampling steps and one output image.

Hardware Selection

The script chooses a device without requiring a separate configuration file. It uses the first available CUDA device when an Nvidia GPU is detected, Apple MPS when supported hardware is available, and CPU otherwise. On CUDA, it enables bfloat16 autocasting during text encoding, transformer sampling and VAE decoding. The CPU path is supported but explicitly described by the script as slow.

The inference file provides a technical description of the model's architecture and execution path. It does not establish a training date, training dataset, hardware used for training, elapsed training time, disk requirements, license, benchmark result or external discussion. It also does not state a precise 104.1-million parameter total; instead, it labels the architecture at approximately 100 million parameters and reports the runtime calculation when the model is built.

Source

SupraLabs on Hugging Face

Explore

More articles