Skip to content

feat(vlm): add PaddleOCR-VL vision-language model with Rust parser - #12

Merged
Brooooooklyn merged 18 commits into
mainfrom
vlm
Feb 2, 2026
Merged

Brooooooklyn merged 18 commits into
mainfrom
vlm

Conversation

@Brooooooklyn

@Brooooooklyn Brooooooklyn commented Jan 31, 2026 •

Copy link
Copy Markdown
Contributor

Implements PaddleOCR-VL-1.5 vision-language model for OCR and document understanding tasks, with a complete Rust-native parser for structured table output.

VLM Implementation

  • Add PaddleOCR-VL model with vision encoder, language model, and projector
  • Implement mRoPE (multimodal Rotary Position Embedding) for image tokens
  • Support chat API with image input via model.chat()
  • Add image preprocessing with smart resize and normalization

Rust Parser (parsePaddleResponse)

  • Parse VLM table tokens (, , , , , )
  • Output formats: markdown, HTML, plain text, raw
  • Fix UTF-8 handling for multi-byte characters (Chinese, Japanese, emoji)
  • 14 Rust tests including UTF-8 edge cases

Error Handling Improvements

  • Change image token count mismatch from warning to error (aligns with mlx-vlm)
  • Change incomplete Q/K/V weight triplets from warning to error
  • Add descriptive error messages with debugging guidance

@mlx-node/vlm Package

  • Export VLModel, ImageProcessor, parseAndFormat utilities
  • Re-export parser functions from Rust via NAPI
  • TypeScript wrapper for lowercase format strings ('markdown', 'html', etc.)

Note

Medium Risk
Medium risk because CI execution flow changes (artifact-based build reuse) and many TypeScript tests are removed, which could reduce regression coverage and hide runtime issues.

Overview
CI is reworked to split native build and tests. The workflow now builds the native module once, uploads the .node and mlx.metallib artifacts, and the test matrix downloads them before running cargo test and yarn build:ts && yarn vite run test (also switching model download to yarn oxnode ./scripts/download-model.ts). The lint job is expanded to include Node yarn typecheck and yarn lint alongside Rust fmt/clippy.

Project hygiene and deps are updated. .gitignore now ignores /mlx-vlm and *.metallib, and the Rust workspace adds unicode-width and image (jpeg/png/webp) dependencies.

TypeScript test coverage is significantly reduced. Numerous __test__/core/* suites (activations, attention, caches, losses, optimizers, numerical consistency, etc.) are deleted, and the remaining autograd training test is updated to use manual SGD instead of Adam.

Written by Cursor Bugbot for commit a54fa48. This will update automatically on new commits. Configure here.

Summary by CodeRabbit

  • New Features

    • Full PaddleOCR‑VL vision‑language support: image chat, OCR, multimodal generation, preprocessing, embeddings, and document parsing/formatting.
  • Package Changes

    • New @mlx-node/vlm package and consolidated VLM public APIs and configs; core package surface refocused toward VLM/document/image utilities.
  • Tests

    • Many new Rust unit tests added; numerous legacy JS test suites removed or migrated to Rust.
  • Documentation

    • Added comprehensive VLM guide and an end‑to‑end TypeScript example.
  • Chores

    • Updated .gitignore and workspace dependency list.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants