Instructions to use staghado/LightOnOCR-2-1B-Q8_0-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use staghado/LightOnOCR-2-1B-Q8_0-GGUF with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf staghado/LightOnOCR-2-1B-Q8_0-GGUF:Q8_0 # Run inference directly in the terminal: llama cli -hf staghado/LightOnOCR-2-1B-Q8_0-GGUF:Q8_0
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf staghado/LightOnOCR-2-1B-Q8_0-GGUF:Q8_0 # Run inference directly in the terminal: llama cli -hf staghado/LightOnOCR-2-1B-Q8_0-GGUF:Q8_0
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf staghado/LightOnOCR-2-1B-Q8_0-GGUF:Q8_0 # Run inference directly in the terminal: ./llama-cli -hf staghado/LightOnOCR-2-1B-Q8_0-GGUF:Q8_0
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf staghado/LightOnOCR-2-1B-Q8_0-GGUF:Q8_0 # Run inference directly in the terminal: ./build/bin/llama-cli -hf staghado/LightOnOCR-2-1B-Q8_0-GGUF:Q8_0
Use Docker
docker model run hf.co/staghado/LightOnOCR-2-1B-Q8_0-GGUF:Q8_0
- LM Studio
- Jan
- Ollama
How to use staghado/LightOnOCR-2-1B-Q8_0-GGUF with Ollama:
ollama run hf.co/staghado/LightOnOCR-2-1B-Q8_0-GGUF:Q8_0
- Unsloth Studio
How to use staghado/LightOnOCR-2-1B-Q8_0-GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for staghado/LightOnOCR-2-1B-Q8_0-GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for staghado/LightOnOCR-2-1B-Q8_0-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for staghado/LightOnOCR-2-1B-Q8_0-GGUF to start chatting
- Atomic Chat new
- Docker Model Runner
How to use staghado/LightOnOCR-2-1B-Q8_0-GGUF with Docker Model Runner:
docker model run hf.co/staghado/LightOnOCR-2-1B-Q8_0-GGUF:Q8_0
- Lemonade
How to use staghado/LightOnOCR-2-1B-Q8_0-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull staghado/LightOnOCR-2-1B-Q8_0-GGUF:Q8_0
Run and chat with the model
lemonade run user.LightOnOCR-2-1B-Q8_0-GGUF-Q8_0
List all available models
lemonade list
LightOnOCR-2-1B GGUF (Q8_0)
GGUF quantized version of lightonai/LightOnOCR-2-1B.
Files
- LightOnOCR-2-1B-Q8_0.gguf (610 MB) - Language model (596M parameters, Q8_0 quantization)
- mmproj-LightOnOCR-2-1B-Q8_0.gguf (429 MB) - Vision encoder (403M parameters, Q8_0 quantization)
Usage
llama-server -hf staghado/LightOnOCR-2-1B-Q8_0-GGUF -c 8192 --temp 0.2 --top-k 0 --top-p 0.9
Note: The flags --temp 0.2 --top-k 0 --top-p 0.9 set the default generation parameters to match the original model.
API Example
import requests
import base64
with open('document.png', 'rb') as f:
image_base64 = base64.b64encode(f.read()).decode()
response = requests.post('http://localhost:8000/v1/chat/completions', json={
"model": "LightOnOCR-2-1B",
"messages": [{
"role": "user",
"content": [
{"type": "image_url", "image_url": {"url": f"data:image/png;base64,{image_base64}"}}
]
}],
"max_tokens": 1024,
"temperature": 0.2,
"top_k": 0,
"top_p": 0.9
})
print(response.json()['choices'][0]['message']['content'])
Note: This model only accepts images, no text prompts.
Creating Quantized Versions
If you want to create your own quantized GGUF files:
Prerequisites
git clone https://github.com/ggml-org/llama.cpp.git
cd llama.cpp
python -m venv venv
source venv/bin/activate
pip install git+https://github.com/huggingface/transformers.git torch sentencepiece
Note: transformers must be installed from source until the next release includes LightOnOCR support.
Conversion Steps
- Download original model
hf download lightonai/LightOnOCR-2-1B --repo-type model --local-dir ./models/LightOnOCR-2-1B
- Convert language model to Q8_0
python convert_hf_to_gguf.py ./models/LightOnOCR-2-1B --outtype q8_0 --outfile LightOnOCR-2-1B-Q8_0.gguf
- Convert vision encoder to Q8_0
python convert_hf_to_gguf.py ./models/LightOnOCR-2-1B --mmproj --outtype q8_0 --outfile mmproj-LightOnOCR-2-1B-Q8_0.gguf
Notes
- Q8_0 provides good quality/speed balance with ~4x compression
- Requires latest llama.cpp from main branch
Details
- Total: 1.01B parameters (vision: 403M + language: 596M + projector: 6M)
- Quantization: Q8_0 (8-bit)
- Tested on M3 Mac: 413 tokens/sec (prompt), 114 tokens/sec (generation)
- Downloads last month
- 157
8-bit
Model tree for staghado/LightOnOCR-2-1B-Q8_0-GGUF
Base model
lightonai/LightOnOCR-2-1B