Image-Text-to-Text
Transformers
Safetensors
Thai
English
nemotron_parse
text-generation
OCR
document-parsing
Thai
Parse
conversational
custom_code
Run this model with HF Jobs
Run Chulinz/Aan-1.0 on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/Chulinz/Aan-1.0. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/Chulinz/Aan-1.0 on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/Chulinz/Aan-1.0. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/Chulinz/Aan-1.0. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use Chulinz/Aan-1.0 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Chulinz/Aan-1.0 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Chulinz/Aan-1.0", 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)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Chulinz/Aan-1.0", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Chulinz/Aan-1.0 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Chulinz/Aan-1.0" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Chulinz/Aan-1.0", "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/Chulinz/Aan-1.0
- SGLang
How to use Chulinz/Aan-1.0 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 "Chulinz/Aan-1.0" \ --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": "Chulinz/Aan-1.0", "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 "Chulinz/Aan-1.0" \ --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": "Chulinz/Aan-1.0", "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 Chulinz/Aan-1.0 with Docker Model Runner:
docker model run hf.co/Chulinz/Aan-1.0
Download hf_parse.py from Chulinz/Aan-1.0: direct link, hf CLI and curl.
- Browser
- Download file 6.52 kB
-
https://huggingface.co/Chulinz/Aan-1.0/resolve/main/hf_parse.py
- Command line
-
hf download hf://Chulinz/Aan-1.0/hf_parse.py
-
curl -L -o hf_parse.py https://huggingface.co/Chulinz/Aan-1.0/resolve/main/hf_parse.py
6.52 kB
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | |
| # SPDX-License-Identifier: OpenMDW-1.1 | |
| """Expose native Parse's visual prefix as sequence positions for NeMo recipes. | |
| Checkpoint tensor names and the native encoder/decoder modules are preserved. | |
| """ | |
| import torch | |
| from torch.nn import functional | |
| from transformers.modeling_outputs import CausalLMOutputWithPast | |
| from .hf_nemotron_parse_modeling import NemotronParseForConditionalGeneration | |
| class ParseForConditionalGeneration(NemotronParseForConditionalGeneration): | |
| def __init__(self, config): | |
| super().__init__(config) | |
| self.configure_trainable_layers() | |
| def from_pretrained(cls, *args, **kwargs): | |
| model = super().from_pretrained(*args, **kwargs) | |
| # HF loading may replace Parameter objects after the constructor runs. | |
| model.configure_trainable_layers() | |
| return model | |
| def configure_trainable_layers(self): | |
| # Accept checkpoints produced before the generic adapter naming. | |
| scope = getattr(self.config, "parse_train_scope", getattr(self.config, "dental_train_scope", "full")) | |
| if scope not in ("full", "decoder", "vision_frozen"): | |
| raise ValueError("Training scope must be full, decoder or vision_frozen") | |
| self.requires_grad_(scope != "decoder") | |
| if scope == "decoder": | |
| self.decoder.requires_grad_(True) | |
| self.lm_head.requires_grad_(True) | |
| # The objective never executes auxiliary MTP heads. Excluding them | |
| # keeps optimizer checkpoint state aligned with parameters that train. | |
| self.decoder.extra_heads.requires_grad_(False) | |
| self.decoder.extra_proj.requires_grad_(False) | |
| def forward( | |
| self, | |
| input_ids=None, | |
| pixel_values=None, | |
| image_sizes=None, | |
| content_sizes=None, | |
| attention_mask=None, | |
| use_cache=False, | |
| return_dict=True, | |
| past_key_values=None, | |
| **kwargs, | |
| ): | |
| """Compute logits aligned with NeMo RL's expanded multimodal sequence. | |
| Args: | |
| input_ids: Long tensor [batch, sequence], beginning with one pad | |
| placeholder for every visual feature. Text follows that prefix. | |
| pixel_values: Packed float patches [patches, 768] or [1, patches, 768]. | |
| image_sizes: Long tensor [batch, 2] of padded image height and width. | |
| content_sizes: Long tensor [batch, 2] of content height and width. | |
| attention_mask: Optional mask [batch, sequence]; visual positions | |
| must be valid. Right padding may be masked. | |
| use_cache: Use the native text-only cached-generation interface when true. | |
| past_key_values: Native generation cache; training does not supply one. | |
| return_dict: Return the standard model output when true. | |
| **kwargs: Position IDs are unused by the native position-free decoder. | |
| Returns: | |
| CausalLMOutputWithPast with logits [batch, sequence, vocab]. Visual | |
| prefix logits are zero placeholders, excluded by the recipe masks. | |
| """ | |
| if use_cache or past_key_values is not None: | |
| return super().forward( | |
| input_ids=input_ids, | |
| pixel_values=pixel_values, | |
| image_sizes=image_sizes, | |
| content_sizes=content_sizes, | |
| attention_mask=attention_mask, | |
| past_key_values=past_key_values, | |
| use_cache=use_cache, | |
| return_dict=return_dict, | |
| **kwargs, | |
| ) | |
| if input_ids is None or image_sizes is None or content_sizes is None: | |
| raise ValueError("Expanded input_ids and both image geometry tensors are required") | |
| counts_from_geometry = [(height // 16) * (width // 64) + 1 for height, width in image_sizes.tolist()] | |
| if len(set(counts_from_geometry)) == 1: | |
| count = counts_from_geometry[0] | |
| if count >= input_ids.shape[1] or not torch.all(input_ids[:, :count] == self.config.pad_token_id): | |
| raise ValueError("Input visual placeholders do not match the encoded image") | |
| if attention_mask is not None and not attention_mask[:, :count].bool().all(): | |
| raise ValueError("Visual placeholders must remain valid in attention_mask") | |
| # Preserve the original forward/backward graph for homogeneous | |
| # geometry, including the single-image cookbook configuration. | |
| native = super().forward( | |
| input_ids=input_ids[:, count:], | |
| pixel_values=pixel_values, | |
| image_sizes=image_sizes, | |
| content_sizes=content_sizes, | |
| attention_mask=None if attention_mask is None else attention_mask[:, count:], | |
| use_cache=False, | |
| return_dict=True, | |
| ) | |
| output = CausalLMOutputWithPast(logits=functional.pad(native.logits, (0, 0, count, 0))) | |
| return output if return_dict else (output.logits, None) | |
| vision, visual_mask = self.encoder(pixel_values, image_sizes, content_sizes) | |
| embeddings = self.decoder.embed_tokens(input_ids) | |
| mask = torch.ones_like(input_ids, dtype=torch.bool) if attention_mask is None else attention_mask.bool() | |
| rows = [] | |
| counts = visual_mask.sum(dim=1).tolist() | |
| for index, count in enumerate(counts): | |
| if count >= input_ids.shape[1] or not torch.all(input_ids[index, :count] == self.config.pad_token_id): | |
| raise ValueError("Input visual placeholders do not match the encoded image") | |
| if not mask[index, :count].all(): | |
| raise ValueError("Visual placeholders must remain valid in attention_mask") | |
| rows.append(torch.cat((vision[index, :count].to(embeddings.dtype), embeddings[index, count:]), dim=0)) | |
| hidden = self.decoder(torch.stack(rows), None, mask) | |
| # Native Parse projects text only. Visual positions have no targets. | |
| logits = torch.cat( | |
| [ | |
| functional.pad(self.lm_head(hidden[index : index + 1, count:]), (0, 0, count, 0)) | |
| for index, count in enumerate(counts) | |
| ], | |
| dim=0, | |
| ) | |
| output = CausalLMOutputWithPast(logits=logits, past_key_values=None) | |
| return output if return_dict else (output.logits, None) | |