Instructions to use mahimairaja/LightOnOCR-2-ft-iam with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use mahimairaja/LightOnOCR-2-ft-iam with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("lightonai/LightOnOCR-2-1B-base") model = PeftModel.from_pretrained(base_model, "mahimairaja/LightOnOCR-2-ft-iam") - Transformers
How to use mahimairaja/LightOnOCR-2-ft-iam with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mahimairaja/LightOnOCR-2-ft-iam") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("mahimairaja/LightOnOCR-2-ft-iam", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use mahimairaja/LightOnOCR-2-ft-iam with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mahimairaja/LightOnOCR-2-ft-iam" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mahimairaja/LightOnOCR-2-ft-iam", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/mahimairaja/LightOnOCR-2-ft-iam
- SGLang
How to use mahimairaja/LightOnOCR-2-ft-iam 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 "mahimairaja/LightOnOCR-2-ft-iam" \ --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": "mahimairaja/LightOnOCR-2-ft-iam", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "mahimairaja/LightOnOCR-2-ft-iam" \ --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": "mahimairaja/LightOnOCR-2-ft-iam", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use mahimairaja/LightOnOCR-2-ft-iam with Docker Model Runner:
docker model run hf.co/mahimairaja/LightOnOCR-2-ft-iam
Download training_args.bin from mahimairaja/LightOnOCR-2-ft-iam: direct link, hf CLI and curl.
- Browser
- Download file 5.14 kB
-
https://huggingface.co/mahimairaja/LightOnOCR-2-ft-iam/resolve/main/training_args.bin
- Command line
-
hf download hf://mahimairaja/LightOnOCR-2-ft-iam/training_args.bin
-
curl -L -o training_args.bin https://huggingface.co/mahimairaja/LightOnOCR-2-ft-iam/resolve/main/training_args.bin
5.14 kB
- Xet hash:
- 73899d48fd9528c65787fe2a1535f35d088cdcf23f8fea05302231b49a99ad62
- Size of remote file:
- 5.14 kB
- SHA256:
- 923ea519418d5f30398917b505b231da40a912af9c7edff54ed6499aafdaafdd
·
Xet efficiently stores Large Files inside Git, intelligently splitting files into unique chunks and accelerating uploads and downloads. More info.