Add native transformers support (DINOv3ViT-compatible weights)

#2
by cherubicxn - opened
Robbyant org

This PR adds native Transformers support alongside the existing reference checkpoint:

  • model.safetensors + config.json β€” DINOv3ViT-compatible weights converted from model.pt (LingBot-Vision backbones are architecturally identical to the DINOv3 ViT implementation in transformers >= 4.56), loadable via AutoModel.from_pretrained(...) with no custom code
  • preprocessor_config.json β€” 512x512 bilinear resize + ImageNet normalization, matching the reference preprocessing
  • README.md β€” library_name: transformers, a Transformers usage snippet, dual-format wording (also fixes the stale lbot_vision_infer import in the existing snippet)

model.pt is unchanged and the reference lingbot_vision loader is unaffected.

Verification: converted weights are numerically equivalent to model.pt under the reference implementation (fp32, CPU): max |diff| = 2e-5 on patch/CLS tokens, including non-square inputs (dynamic RoPE). Load path tested on transformers 4.56.0 and 5.5.3. Conversion script: scripts/convert_to_transformers.py in the GitHub repo.

Hello @cherubicxn , Pablo from transformers team here, I think the tag dinov3 would also be worth being added! I tried and indeed the model works very well out-of-the-box with transformers πŸ€—

Cannot merge
This branch has merge conflicts in the following files:
  • README.md

Sign up or log in to comment