MingTok extracted from Ming-UniVision
Continuous low-level encoder, semantic decoder, semantic-to-pixel projection and pixel decoder. Input pixels -> continuous latent -> semantic features -> reconstructed pixels. Language-side linear_proj, vis_head and diffloss are excluded.
连续视觉 tokenizer:保留编码、语义展开和像素重建;不含语言主干及语言侧投影/潜变量预测头。
Provenance
Extracted from inclusionAI/Ming-UniVision-16B-A3B at fd5817707d0602858b0c76722179dd2bae9892c4. Native code revision and attribution are recorded in code_provenance.json and NOTICE. No language model is instantiated by the loader. This repository is an unofficial component export, not an official release from the original authors.
- Tensors: 738; stored parameters/elements: 697,719,584.
- Tensor payload: 1,395,439,168 bytes; dtype: ['BF16'].
- Main checkpoint SHA256:
b17a16e0559740e19fbe33a53c1d1abfe2e1ed9ef87d6eaf226d32bdbc511914. - Full source configuration is preserved separately as
source_config.json; the custom root config documents this package only. This is an explicit Python loader, not a registered AutoModel or timm architecture.
Use
Install requirements.txt in a dedicated environment. Source files are vendored at a pinned upstream revision. The loader strictly checks every state key.
import sys, torch
from huggingface_hub import snapshot_download
path = snapshot_download("gatilin/mingtok_ming_univision_16b_a3b")
sys.path.insert(0, path)
from component import load_model
model = load_model(path) # CPU; BF16 for UniAR, FP32 for other components
x = torch.zeros(1, 3, 512, 512) # RGB normalized to [-1, 1], square
with torch.inference_mode():
encoded = model(x)
latent = encoded["latent"]
reconstructed_pixels = model.forward_pixel_decoder(encoded["x_norm_patchtokens"])
# For predicted normalized latents use model.forward_feature_decoder(latent).
# The no-cache method expects unnormalized latents (latent * scaling_factor + mean).
Validation
validation.json records all checks: original source tensor bytes match, strict loading passes, 2 native equivalence cases pass, plus the useful-resolution smoke case 512_pixel_reconstruction. Tests ran with FP32 on CPU. Where supported, native eager reference attention was compared to SDPA in the exported loader. Discrete token/bit outputs are checked exactly; floating outputs use tolerance documented in the validation script.
The reference loads original source ranges directly; the exported loader independently reads the assembled Safetensors checkpoint. Tests cover only the component APIs. They do not establish downstream understanding accuracy, text-to-image quality, or GPU/FlashAttention equivalence. Synthetic input images/tensors are used; reconstruction is lossy and no pixel-fidelity benchmark is claimed.
Reproduce extraction with extract_unified_components.py mingtok (default outputs alongside the script); then run python validate_unified_components.py PATH. The byte comparison requires .download source chunks, which extraction creates but this repository intentionally does not upload.
License and attribution
The original weight and code licenses remain applicable. Preserve upstream author notices. See LICENSE, NOTICE, SOURCE_README.md, and source-file headers.
The parent checkpoint root vision_config is stale Qwen2.5-ViT metadata. This export uses the official MingTok configuration (including latent scaling 8.09449291 and mean 1.46817409); all 738 state keys and shapes are strictly verified. The independent MingTok-Vision checkpoint also exists upstream; these weights were extracted specifically from the integrated Ming-UniVision release.
Image preprocessing
Use the vendored official from mingtok.utils import CenterCropProcessor; CenterCropProcessor(image_size=512)(pil_rgb_image).unsqueeze(0) produces the BCHW input expected above. Resize the shorter edge with bicubic interpolation, center crop 512x512, convert to [0,1] and normalize with mean/std 0.5. The parent checkpoint also contains stale Qwen/audio processor metadata; those original bytes are preserved as source_preprocessor_config.json. The root preprocessor_config.json describes this explicit MingTok processor and is not an AutoProcessor registration.