UniSpace PR-DINOv2 unified visual tokenizer
Lossless extraction of the complete EMA visual tokenizer from yjb6/UniSpace, revision 0f0fdf941329f570be65e6c6549b8452e1f967b1, file encoders/pr-dinov2-tokenizer.pt. Original code/config revision: f73f8720c72c82e0fe468bb4f8f72b0e2b9a11d7.
The complete 12-layer shared DINOv2 backbone, independent semantic/reconstruction image embeddings, reconstruction projection, both normalization paths and the complete 28-layer reconstruction decoder are retained. The original 687 EMA tensors remain float32 and byte-identical. Matching per-position/per-channel normalization statistics are included. Online model, optimizer and discriminator training state are excluded.
Input and output
encode accepts RGB float tensors [B,3,H,W] in [0,1]. Original preprocessing resizes to 224x224 using PyTorch bicubic interpolation when needed and applies the retained DINO mean/std. The two trained embedding paths share the backbone; semantic and reconstruction tokens are concatenated to [B,256,896] (768 + 128 channels). Exact original [256,896] statistics normalize each token/channel, followed by the [B,896,16,16] grid view used by the matching class-conditional DiT.
decode accepts that normalized grid, restores the original feature scale and token order, runs all reconstruction decoder layers, unpatchifies to RGB 256x256 and restores RGB mean/std. Values are not silently clamped. The original release sets decode_noise=True; pass decode_noise=False for deterministic reconstruction. Reset the Torch seed to reproduce the default noisy decoder path.
import torch
from component import load_model
model = load_model('/path/to/package')
with torch.inference_mode():
latents = model.encode(rgb_float_0_1)
rgb_reconstruction = model.decode(latents, decode_noise=False)
original_features = model.encode_features(rgb_float_0_1)
This tokenizer supports semantic features, reconstruction and the matching PR-DINOv2 class DiT. It is distinct from the full Qwen3-8B UniSpace multimodal MoT and from its PR-Qwen-ViT tokenizer. It is not an interchangeable 4/16-channel VAE, nor a complete language model.
Offline loading and integrity
All tokenizer weights are included; the base DINO configuration and image-processor configuration are retained locally. The loader constructs the base architecture from this local config and strictly loads the full trained EMA state, without downloading a second pretrained model. native_adaptation.json records this initialization-only adaptation. Original learned computations and preprocessing are retained.
extraction.json, tensor_mapping.json and tensor_sha256.json document selected EMA storages, original ZIP CRCs, source offsets and output hashes. Source training checkpoint namespaces are removed at the component boundary; tensor names inside the native tokenizer, shapes, dtypes and values are preserved. The containing training checkpoint was not fully downloaded or claimed as whole-file LFS verified.
Validation
Run python verify_release.py /path/to/package. See validation.json for the actual checks and numerical measurements: all EMA payloads, strict loading, native full encoder/decoder depth, normalized semantic/reconstruction output layout, independent attention, RGB reconstruction, explicit latent denormalization and unpatchification, and original seeded decoder-noise behavior. Synthetic RGB fixtures are used. No paper reconstruction benchmark or complete multimodal-language capability is claimed.
Original MIT license, Apache notices in inherited architecture files and third-party notices are retained. See LICENSE, THIRD_PARTY.md, and base_config_provenance.json.
Matching class-conditioned DiT: gatilin/unispace_pr_dinov2_class_conditional_dit. This pairing is separate from the full UniSpace Qwen3-8B MoT.
- Downloads last month
- 22