Instructions to use Yesianrohn/openocrv2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Yesianrohn/openocrv2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Yesianrohn/openocrv2")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Yesianrohn/openocrv2", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Yesianrohn/openocrv2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Yesianrohn/openocrv2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Yesianrohn/openocrv2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Yesianrohn/openocrv2
- SGLang
How to use Yesianrohn/openocrv2 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 "Yesianrohn/openocrv2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Yesianrohn/openocrv2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "Yesianrohn/openocrv2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Yesianrohn/openocrv2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Yesianrohn/openocrv2 with Docker Model Runner:
docker model run hf.co/Yesianrohn/openocrv2
Update modeling_openocrv2_rec_ar.py
Browse files
modeling_openocrv2_rec_ar.py
CHANGED
|
@@ -1,11 +1,3 @@
|
|
| 1 |
-
# Generated by ocr_hf/export/build_repos.py -- do not edit.
|
| 2 |
-
#
|
| 3 |
-
# OpenOCRv2_Rec_AR: text recognizer.
|
| 4 |
-
#
|
| 5 |
-
# Architecture code is derived from OpenOCR (Apache-2.0) and the MMOCR
|
| 6 |
-
# HGNetv2 implementation (Apache-2.0); licence texts are in the LICENSES folder.
|
| 7 |
-
"""Self-contained model file for ``trust_remote_code`` loading."""
|
| 8 |
-
|
| 9 |
import numpy as np
|
| 10 |
import torch
|
| 11 |
from torch import nn
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import numpy as np
|
| 2 |
import torch
|
| 3 |
from torch import nn
|