Hugging Face's logo Hugging Face
  • Models
  • Datasets
  • Spaces
  • Buckets
  • Docs
  • Enterprise
  • Pricing
    • Website
      • Tasks
      • HuggingChat
      • Collections
      • Languages
      • Organizations
    • Community
      • Blog
      • Posts
      • Daily Papers
      • Hardware
      • Learn
      • Discord
      • Forum
      • GitHub
    • Solutions
      • Team & Enterprise
      • Hugging Face PRO
      • Enterprise Support
      • Inference Providers
      • Inference Endpoints
      • Storage Buckets

  • Log In
  • Sign Up

litert-community
/
MiniCPM-OCR-1.0

Image-Text-to-Text
LiteRT-LM
LiteRT
MiniCPM-OCR
English
Chinese
litertlm
on-device
edge
ocr
document-parsing
table-recognition
formula-recognition
vision-language
Model card Files Files and versions
xet
Community

Instructions to use litert-community/MiniCPM-OCR-1.0 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.

  • Libraries
  • LiteRT-LM

    How to use litert-community/MiniCPM-OCR-1.0 with LiteRT-LM:

    # LiteRT-LM runs on various platforms (Android, iOS, Windows, Linux, macOS, IoT, Web/WASM)
    # and supports many APIs (C++, Python, Kotlin, Swift, JavaScript, Flutter).
    # For platform-specific integration guides, please refer to the official developer website:
    # https://ai.google.dev/edge/litert-lm
    
    # To try LiteRT-LM, the easiest way is to use our CLI tool.
    # 1. Install the LiteRT-LM CLI tool:
    pip install -U litert-lm
    
    # 2. Download and run this model locally:
    # See: https://ai.google.dev/edge/litert-lm/cli
    # A single .litertlm file in the repo is picked automatically; otherwise the CLI asks which one to run
    # (or pass its name right after the repo id).
    litert-lm run \
      --from-huggingface-repo=litert-community/MiniCPM-OCR-1.0 \
      --prompt="Write me a poem"
  • LiteRT

    How to use litert-community/MiniCPM-OCR-1.0 with LiteRT:

    # No code snippets available yet for this library.
    
    # To use this model, check the repository files and the library's documentation.
    
    # Want to help? PRs adding snippets are welcome at:
    # https://github.com/huggingface/huggingface.js
  • MiniCPM-OCR

    How to use litert-community/MiniCPM-OCR-1.0 with MiniCPM-OCR:

    pip install "minicpm-ocr[all]" huggingface_hub
    
    # Deploy litert-community/MiniCPM-OCR-1.0 as a recognition service before running the Python example:
    # https://github.com/OpenBMB/MiniCPM-OCR/blob/main/docs/vllm_deploy_en.md
    # vLLM: load the model above; use --port 8080,
    # --served-model-name minicpm-ocr and --max-model-len 40960.
    # Layout detection uses cuda:0; recognition runs on the deployed service.
    from importlib.resources import files
    from pathlib import Path
    
    from minicpmvocr import load_config, pipelined_run
    from huggingface_hub import snapshot_download
    
    layout_model = snapshot_download("PaddlePaddle/PP-DocLayoutV3")
    cfg = load_config(
        str(files("minicpmvocr").joinpath("configs/minicpmvocr.yaml")),
        overrides={
            "input": {"file_path": str(Path("demo.png").resolve())},
            "engine": {
                "type": "vllm",
                "server_url": "http://127.0.0.1:8080",
                "model_name": "minicpm-ocr",
                "max_model_len": 40960,
            },
            "layout": {"model_dir": layout_model, "device": "cuda:0"},
            # Render PDFs in-process so this example also works without a main guard.
            "pipeline": {"overlap_layout": True, "render_workers": 1},
        },
    )
    pipelined_run(cfg)
  • Notebooks
  • Google Colab
  • Kaggle
MiniCPM-OCR-1.0 / samples
140 kB
Ctrl+K
Ctrl+K
  • 1 contributor
History: 1 commit
mlboydaisuke's picture
mlboydaisuke
MiniCPM-OCR-1.0 for LiteRT-LM: int8 decoder + fp16 vision, regions and tiled pages
c818533 verified 13 days ago
  • formula_1.png
    7.92 kB
    MiniCPM-OCR-1.0 for LiteRT-LM: int8 decoder + fp16 vision, regions and tiled pages 13 days ago
  • line_en_448.png
    9.84 kB
    MiniCPM-OCR-1.0 for LiteRT-LM: int8 decoder + fp16 vision, regions and tiled pages 13 days ago
  • page_en.png
    77 kB
    MiniCPM-OCR-1.0 for LiteRT-LM: int8 decoder + fp16 vision, regions and tiled pages 13 days ago
  • receipt.png
    29.2 kB
    MiniCPM-OCR-1.0 for LiteRT-LM: int8 decoder + fp16 vision, regions and tiled pages 13 days ago
  • table.png
    16.2 kB
    MiniCPM-OCR-1.0 for LiteRT-LM: int8 decoder + fp16 vision, regions and tiled pages 13 days ago