Hugging Face's logo Hugging Face
  • Models
  • Datasets
  • Spaces
  • Buckets new
  • Docs
  • Enterprise
  • Pricing

  • Log In
  • Sign Up

hadeseus
/
HunyuanOCR-mlx

Image-Text-to-Text
Transformers
Safetensors
MLX
multilingual
hunyuan_vl
text-generation
ocr
hunyuan
vision-language
image-to-text
1B
end-to-end
conversational
Model card Files Files and versions
xet
Community

Instructions to use hadeseus/HunyuanOCR-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.

  • Libraries
  • Transformers

    How to use hadeseus/HunyuanOCR-mlx with Transformers:

    # Use a pipeline as a high-level helper
    from transformers import pipeline
    
    pipe = pipeline("image-text-to-text", model="hadeseus/HunyuanOCR-mlx")
    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 AutoModelForSeq2SeqLM
    model = AutoModelForSeq2SeqLM.from_pretrained("hadeseus/HunyuanOCR-mlx", dtype="auto")
  • MLX

    How to use hadeseus/HunyuanOCR-mlx with MLX:

    # Make sure mlx-vlm is installed
    # pip install --upgrade mlx-vlm
    
    from mlx_vlm import load, generate
    from mlx_vlm.prompt_utils import apply_chat_template
    from mlx_vlm.utils import load_config
    
    # Load the model
    model, processor = load("hadeseus/HunyuanOCR-mlx")
    config = load_config("hadeseus/HunyuanOCR-mlx")
    
    # Prepare input
    image = ["http://images.cocodataset.org/val2017/000000039769.jpg"]
    prompt = "Describe this image."
    
    # Apply chat template
    formatted_prompt = apply_chat_template(
        processor, config, prompt, num_images=1
    )
    
    # Generate output
    output = generate(model, processor, formatted_prompt, image)
    print(output)
  • Notebooks
  • Google Colab
  • Kaggle
  • Local Apps
  • LM Studio
  • vLLM

    How to use hadeseus/HunyuanOCR-mlx with vLLM:

    Install from pip and serve model
    # Install vLLM from pip:
    pip install vllm
    # Start the vLLM server:
    vllm serve "hadeseus/HunyuanOCR-mlx"
    # Call the server using curl (OpenAI-compatible API):
    curl -X POST "http://localhost:8000/v1/chat/completions" \
    	-H "Content-Type: application/json" \
    	--data '{
    		"model": "hadeseus/HunyuanOCR-mlx",
    		"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/hadeseus/HunyuanOCR-mlx
  • SGLang

    How to use hadeseus/HunyuanOCR-mlx 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 "hadeseus/HunyuanOCR-mlx" \
        --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": "hadeseus/HunyuanOCR-mlx",
    		"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 "hadeseus/HunyuanOCR-mlx" \
            --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": "hadeseus/HunyuanOCR-mlx",
    		"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 hadeseus/HunyuanOCR-mlx with Docker Model Runner:

    docker model run hf.co/hadeseus/HunyuanOCR-mlx
HunyuanOCR-mlx
2 GB
Ctrl+K
Ctrl+K
  • 1 contributor
History: 2 commits
hadeseus's picture
hadeseus
Upload folder using huggingface_hub
dd3aded verified 3 months ago
  • .gitattributes
    1.52 kB
    initial commit 3 months ago
  • README.md
    675 Bytes
    Upload folder using huggingface_hub 3 months ago
  • chat_template.jinja
    994 Bytes
    Upload folder using huggingface_hub 3 months ago
  • config.json
    2.15 kB
    Upload folder using huggingface_hub 3 months ago
  • generation_config.json
    205 Bytes
    Upload folder using huggingface_hub 3 months ago
  • model.safetensors
    1.99 GB
    xet
    Upload folder using huggingface_hub 3 months ago
  • model.safetensors.index.json
    58.4 kB
    Upload folder using huggingface_hub 3 months ago
  • preprocessor_config.json
    370 Bytes
    Upload folder using huggingface_hub 3 months ago
  • processor_config.json
    535 Bytes
    Upload folder using huggingface_hub 3 months ago
  • special_tokens_map.json
    146 Bytes
    Upload folder using huggingface_hub 3 months ago
  • tokenizer.json
    9.53 MB
    Upload folder using huggingface_hub 3 months ago
  • tokenizer_config.json
    1.02 kB
    Upload folder using huggingface_hub 3 months ago