Instructions to use JamePeng2023/DeepSeek-OCR-2-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 JamePeng2023/DeepSeek-OCR-2-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 JamePeng2023/DeepSeek-OCR-2-GGUF:BF16 # Run inference directly in the terminal: llama cli -hf JamePeng2023/DeepSeek-OCR-2-GGUF:BF16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf JamePeng2023/DeepSeek-OCR-2-GGUF:BF16 # Run inference directly in the terminal: llama cli -hf JamePeng2023/DeepSeek-OCR-2-GGUF:BF16
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 JamePeng2023/DeepSeek-OCR-2-GGUF:BF16 # Run inference directly in the terminal: ./llama-cli -hf JamePeng2023/DeepSeek-OCR-2-GGUF:BF16
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 JamePeng2023/DeepSeek-OCR-2-GGUF:BF16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf JamePeng2023/DeepSeek-OCR-2-GGUF:BF16
Use Docker
docker model run hf.co/JamePeng2023/DeepSeek-OCR-2-GGUF:BF16
- LM Studio
- Jan
- vLLM
How to use JamePeng2023/DeepSeek-OCR-2-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "JamePeng2023/DeepSeek-OCR-2-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "JamePeng2023/DeepSeek-OCR-2-GGUF", "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/JamePeng2023/DeepSeek-OCR-2-GGUF:BF16
- Ollama
How to use JamePeng2023/DeepSeek-OCR-2-GGUF with Ollama:
ollama run hf.co/JamePeng2023/DeepSeek-OCR-2-GGUF:BF16
- Unsloth Desktop
- Docker Model Runner
How to use JamePeng2023/DeepSeek-OCR-2-GGUF with Docker Model Runner:
docker model run hf.co/JamePeng2023/DeepSeek-OCR-2-GGUF:BF16
- Lemonade
How to use JamePeng2023/DeepSeek-OCR-2-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull JamePeng2023/DeepSeek-OCR-2-GGUF:BF16
Run and chat with the model
lemonade run user.DeepSeek-OCR-2-GGUF-BF16
List all available models
lemonade list
- Atomic Chat
The DeepSeek-OCR 1/2 is now supported in llama-cpp-python. This project provides a test GGUF file.
Note: Based on current testing, it is not particularly stable.
llama-cpp-python: https://github.com/JamePeng/llama-cpp-python
Code example:
import base64
from pathlib import Path
from llama_cpp import Llama
from llama_cpp.llama_chat_format import MTMDChatHandler
MODEL_PATH = "./DeepSeek-OCR-2-BF16.gguf"
MMPROJ_PATH = "./mmproj-DeepSeek-OCR-2-BF16.gguf"
IMAGE_PATH = Path("deepseekocr2.png")
# OCR prompts:
# OCR_PROMPT = "\nFree OCR."
OCR_PROMPT = "\n<|grounding|>Convert the document to markdown."
_IMAGE_MIME_TYPES = {
".png": "image/png",
".jpg": "image/jpeg",
".jpeg": "image/jpeg",
".webp": "image/webp",
".bmp": "image/bmp",
}
def image_to_data_uri(image_path: Path) -> str:
"""Encode a local image as a data URI."""
if not image_path.is_file():
raise FileNotFoundError(f"Image file not found: {image_path}")
mime_type = _IMAGE_MIME_TYPES.get(image_path.suffix.lower(), "application/octet-stream")
encoded = base64.b64encode(image_path.read_bytes()).decode("utf-8")
return f"data:{mime_type};base64,{encoded}"
llm = Llama(
model_path=MODEL_PATH,
chat_handler=MTMDChatHandler(
clip_model_path=MMPROJ_PATH,
verbose=True,
),
n_gpu_layers=-1,
n_ctx=10240,
verbose=False,
verbosity=1,
)
response = llm.create_chat_completion(
messages=[
{
"role": "user",
"content": [
{
"type": "image_url",
"image_url": {
"url": image_to_data_uri(IMAGE_PATH),
},
},
{
"type": "text",
"text": OCR_PROMPT,
},
],
}
],
max_tokens=4096,
)
print(response["choices"][0]["message"]["content"])
- Downloads last month
- 466
Hardware compatibility
Log In to add your hardware
8-bit
16-bit
Model tree for JamePeng2023/DeepSeek-OCR-2-GGUF
Base model
deepseek-ai/DeepSeek-OCR-2