Back to directory

MoonViT - Pytorch

A single-file PyTorch implementation of MoonViT, the native-resolution vision encoder from Kimi-VL, that packs images of different sizes into one sequence instead of resizing or padding them.

MoonViT - Pytorch

MoonViT tokenizes each image at its own native height and width and packs images of different shapes into one long sequence, so a large screenshot and a small portrait can share a batch without resizing, distortion or padding tokens. It combines an interpolated SigLIP absolute position embedding, which preserves the pretrained prior, with two-dimensional RoPE for fine-grained, resolution-robust position information, and uses variable-length attention so that each image only attends to itself within the packed sequence.

An included MLP projector composes with the encoder to feed a language model: it applies a two-by-two pixel-shuffle that turns four tokens into one with four times the channels, then a two-layer MLP that projects into the LLM's hidden size. FlashAttention is used automatically when available on CUDA, and a block-diagonal scaled-dot-product-attention fallback runs on CPU, MPS or CUDA with no extra dependencies. It installs from PyPI or from source and is Apache-2.0 licensed.

More in Models

See all 405
  • mini-AGI

    github.com

    A continual learning language model that trains from scratch on a single 8 GB VRAM GPU, assembling its own architecture and adapting its size to the hardware and data available rather than shipping as a fixed pretrained model.

  • An open-source contrastive-embedding pipeline that maps technical CVE vulnerability descriptions to formal cybersecurity compliance controls in NIST SP 800-53 and CMMC, published with its model generation, fine-tuning and evaluation code.

  • peekaboolean

    github.com

    A small vision-language model, fine-tuned with LoRA on a 500-million-parameter backbone, that answers typed multiple-choice, ordinal-score and yes/no questions about an image with calibrated probabilities, in about 400 milliseconds on a laptop.