Skip to content

Add baidu/Unlimited-OCR vision tower support (feature-extraction)#1018

Draft
ssss141414 wants to merge 2 commits into
mainfrom
shzhen/add-unlimited-ocr
Draft

Add baidu/Unlimited-OCR vision tower support (feature-extraction)#1018
ssss141414 wants to merge 2 commits into
mainfrom
shzhen/add-unlimited-ocr

Conversation

@ssss141414

Copy link
Copy Markdown
Contributor

Register an OnnxConfig + wrapper that exports the Unlimited-OCR vision tower (SAM ViT-B + CLIP-L-14 + MLP projector) under the feature-extraction task, so winml config/build natively produce the vision-embedding ONNX artifact.

What

  • unlimited_ocr.py: UnlimitedOCRVisionTowerWrapper (AutoModel + get_model(), composes sam_model/vision_model/projector) and UnlimitedOCRVisionIOConfig registered via @register_onnx_overwrite for (unlimited-ocr, feature-extraction) with static [1,3,1024,1024] dummy inputs and an image_embeds output.
  • hf/__init__.py: wire the model-class mapping and trigger registration.
  • tests: network-free unit tests validating registry wiring and the IO contract.

Validation

  • 6 unit tests pass; ruff clean.
  • ONNX exports, loads, and runs on ORT CPU; output matches PyTorch eager (cosine = 1.000000).

Scope

Vision tower only. The full generative DeepSeek-V2 decoder path is out of scope.

Register an OnnxConfig + wrapper that exports the Unlimited-OCR vision tower (SAM ViT-B + CLIP-L-14 + MLP projector) under the feature-extraction task, so winml config/build natively produce the vision-embedding ONNX artifact.

- unlimited_ocr.py: UnlimitedOCRVisionTowerWrapper (AutoModel + get_model, composes sam_model/vision_model/projector) and UnlimitedOCRVisionIOConfig registered via @register_onnx_overwrite for (unlimited-ocr, feature-extraction) with static [1,3,1024,1024] dummy inputs and image_embeds output.
- hf/__init__.py: wire the model-class mapping and trigger registration.
- tests: network-free unit tests validating registry wiring and IO contract.
from transformers import PretrainedConfig

# Import triggers ONNX config registration
import winml.modelkit.models # noqa: F401
…e deps

The baidu/Unlimited-OCR trust_remote_code modeling code imports addict, einops, easydict and matplotlib. Expose them as an optional extra so 'winml build baidu/Unlimited-OCR' is reproducible from a clean checkout via 'pip install winml-modelkit[unlimited-ocr]', mirroring the existing audio/openvino/qnn extras.
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