Image-Text-to-Text
Transformers
Safetensors
ovis2_6
text-generation
ocr
document-parsing
document-understanding
multimodal
markdown
tables
formulas
vllm
conversational
custom_code
Instructions to use ATH-MaaS/OvisOCR with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ATH-MaaS/OvisOCR with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="ATH-MaaS/OvisOCR", trust_remote_code=True) messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("ATH-MaaS/OvisOCR", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ATH-MaaS/OvisOCR with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ATH-MaaS/OvisOCR" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ATH-MaaS/OvisOCR", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/ATH-MaaS/OvisOCR
- SGLang
How to use ATH-MaaS/OvisOCR with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "ATH-MaaS/OvisOCR" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ATH-MaaS/OvisOCR", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "ATH-MaaS/OvisOCR" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ATH-MaaS/OvisOCR", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use ATH-MaaS/OvisOCR with Docker Model Runner:
docker model run hf.co/ATH-MaaS/OvisOCR
| from typing import Any, Optional, List, Union | |
| from transformers import Qwen3Config, Qwen3MoeConfig, Qwen3NextConfig | |
| from transformers.configuration_utils import PretrainedConfig | |
| __all__ = ["Siglip2NavitConfig", "Ovis2_6_Config"] | |
| class Siglip2NavitConfig(PretrainedConfig): | |
| """This is the configuration class to store the configuration of an [`AIMv2Model`]. | |
| Instantiating a configuration with the defaults will yield a similar configuration | |
| to that of the [apple/aimv2-large-patch14-224](https://huggingface.co/apple/aimv2-large-patch14-224). | |
| Args: | |
| hidden_size: Dimension of the hidden representations. | |
| intermediate_size: Dimension of the SwiGLU representations. | |
| num_hidden_layers: Number of hidden layers in the Transformer. | |
| num_attention_heads: Number of attention heads for each attention layer | |
| in the Transformer. | |
| num_channels: Number of input channels. | |
| image_size: Image size. | |
| patch_size: Patch size. | |
| rms_norm_eps: Epsilon value used for the RMS normalization layer. | |
| attention_dropout: Dropout ratio for attention probabilities. | |
| projection_dropout: Dropout ratio for the projection layer after the attention. | |
| qkv_bias: Whether to add a bias to the queries, keys and values. | |
| use_bias: Whether to add a bias in the feed-forward and projection layers. | |
| kwargs: Keyword arguments for the [`PretrainedConfig`]. | |
| """ | |
| model_type: str = "siglip2_navit" | |
| def __init__( | |
| self, | |
| hidden_size: int = 1024, | |
| intermediate_size: int = 4096, | |
| num_hidden_layers: int = 24, | |
| num_attention_heads: int = 16, | |
| num_channels: int = 3, | |
| num_patches: int = -1, | |
| image_size: int = 512, | |
| patch_size: int = 16, | |
| hidden_act: str="gelu_pytorch_tanh", | |
| layer_norm_eps: float = 1e-6, | |
| attention_dropout: float = 0.0, | |
| hidden_stride: int = 2, | |
| window_size: int = 112, | |
| fullatt_block_indexes: Optional[list] = None, | |
| temporal_patch_size: int = 1, | |
| preserve_original_pe: bool = True, | |
| use_rope: bool = True, | |
| **kwargs: Any, | |
| ): | |
| super().__init__(**kwargs) | |
| self.hidden_size = hidden_size | |
| self.intermediate_size = intermediate_size | |
| self.num_hidden_layers = num_hidden_layers | |
| self.num_attention_heads = num_attention_heads | |
| self.num_channels = num_channels | |
| self.num_patches = num_patches | |
| self.patch_size = patch_size | |
| self.image_size = image_size | |
| self.hidden_act = hidden_act | |
| self.attention_dropout = attention_dropout | |
| self.layer_norm_eps = layer_norm_eps | |
| self.hidden_stride = hidden_stride | |
| self.window_size = window_size | |
| self.fullatt_block_indexes = fullatt_block_indexes | |
| self.temporal_patch_size = temporal_patch_size | |
| self.preserve_original_pe = preserve_original_pe | |
| self.use_rope = use_rope | |
| class Ovis2_6_Config(PretrainedConfig): | |
| model_type = "ovis2_6" | |
| sub_configs = dict(llm_config=Qwen3Config, vit_config=Siglip2NavitConfig) | |
| def __init__(self, | |
| llm_config: Optional[Union[Qwen3Config, dict]] = None, | |
| vit_config: Optional[Union[Siglip2NavitConfig, dict]] = None, | |
| visual_vocab_size=65536, | |
| hidden_size=None, | |
| **kwargs | |
| ): | |
| super().__init__(**kwargs) | |
| if isinstance(llm_config, dict): | |
| llm_config = Qwen3Config(**llm_config) | |
| self.llm_config = llm_config | |
| if isinstance(vit_config, dict): | |
| vit_config = Siglip2NavitConfig(**vit_config) | |
| self.vit_config = vit_config | |
| self.visual_vocab_size = visual_vocab_size | |
| self.hidden_size = hidden_size | |
| if kwargs.get('attn_implementation'): | |
| self.llm_config._attn_implementation = kwargs['attn_implementation'] | |
| self.vit_config._attn_implementation = kwargs['attn_implementation'] | |
| class Ovis2_6_Moe_Config(PretrainedConfig): | |
| model_type = "ovis2_6_moe" | |
| sub_configs = dict(llm_config=Qwen3MoeConfig, vit_config=Siglip2NavitConfig) | |
| def __init__(self, | |
| llm_config: Optional[Union[Qwen3MoeConfig, dict]] = None, | |
| vit_config: Optional[Union[Siglip2NavitConfig, dict]] = None, | |
| visual_vocab_size=65536, | |
| hidden_size=None, | |
| **kwargs | |
| ): | |
| super().__init__(**kwargs) | |
| if isinstance(llm_config, dict): | |
| llm_config = Qwen3MoeConfig(**llm_config) | |
| self.llm_config = llm_config | |
| if isinstance(vit_config, dict): | |
| vit_config = Siglip2NavitConfig(**vit_config) | |
| self.vit_config = vit_config | |
| self.visual_vocab_size = visual_vocab_size | |
| self.hidden_size = hidden_size | |
| if kwargs.get('attn_implementation'): | |
| self.llm_config._attn_implementation = kwargs['attn_implementation'] | |
| self.vit_config._attn_implementation = kwargs['attn_implementation'] | |
| class Ovis2_6_Next_Config(PretrainedConfig): | |
| model_type = "ovis2_6_next" | |
| sub_configs = dict(llm_config=Qwen3NextConfig, vit_config=Siglip2NavitConfig) | |
| def __init__(self, | |
| llm_config: Optional[Union[Qwen3NextConfig, dict]] = None, | |
| vit_config: Optional[Union[Siglip2NavitConfig, dict]] = None, | |
| visual_vocab_size=65536, | |
| hidden_size=None, | |
| **kwargs | |
| ): | |
| super().__init__(**kwargs) | |
| if isinstance(llm_config, dict): | |
| llm_config = Qwen3NextConfig(**llm_config) | |
| self.llm_config = llm_config | |
| if isinstance(vit_config, dict): | |
| vit_config = Siglip2NavitConfig(**vit_config) | |
| self.vit_config = vit_config | |
| self.visual_vocab_size = visual_vocab_size | |
| self.hidden_size = hidden_size | |
| if kwargs.get('attn_implementation'): | |
| self.llm_config._attn_implementation = kwargs['attn_implementation'] | |
| self.vit_config._attn_implementation = kwargs['attn_implementation'] | |