Image-Text-to-Text
GGUF
German
English
ocr
vision-language-model
german
document-ai
llama-cpp
conversational
Instructions to use Keyven/german-ocr-2b-gguf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use Keyven/german-ocr-2b-gguf with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="Keyven/german-ocr-2b-gguf", filename="German-OCR-Engine.2B.gguf", )
llm.create_chat_completion( 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" } } ] } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Keyven/german-ocr-2b-gguf with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf Keyven/german-ocr-2b-gguf # Run inference directly in the terminal: llama-cli -hf Keyven/german-ocr-2b-gguf
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf Keyven/german-ocr-2b-gguf # Run inference directly in the terminal: llama-cli -hf Keyven/german-ocr-2b-gguf
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 Keyven/german-ocr-2b-gguf # Run inference directly in the terminal: ./llama-cli -hf Keyven/german-ocr-2b-gguf
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 Keyven/german-ocr-2b-gguf # Run inference directly in the terminal: ./build/bin/llama-cli -hf Keyven/german-ocr-2b-gguf
Use Docker
docker model run hf.co/Keyven/german-ocr-2b-gguf
- LM Studio
- Jan
- vLLM
How to use Keyven/german-ocr-2b-gguf with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Keyven/german-ocr-2b-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": "Keyven/german-ocr-2b-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/Keyven/german-ocr-2b-gguf
- Ollama
How to use Keyven/german-ocr-2b-gguf with Ollama:
ollama run hf.co/Keyven/german-ocr-2b-gguf
- Unsloth Studio
How to use Keyven/german-ocr-2b-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 Keyven/german-ocr-2b-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 Keyven/german-ocr-2b-gguf to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Keyven/german-ocr-2b-gguf to start chatting
- Pi
How to use Keyven/german-ocr-2b-gguf with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf Keyven/german-ocr-2b-gguf
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "Keyven/german-ocr-2b-gguf" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use Keyven/german-ocr-2b-gguf with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf Keyven/german-ocr-2b-gguf
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default Keyven/german-ocr-2b-gguf
Run Hermes
hermes
- Docker Model Runner
How to use Keyven/german-ocr-2b-gguf with Docker Model Runner:
docker model run hf.co/Keyven/german-ocr-2b-gguf
- Lemonade
How to use Keyven/german-ocr-2b-gguf with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Keyven/german-ocr-2b-gguf
Run and chat with the model
lemonade run user.german-ocr-2b-gguf-{{QUANT_TAG}}List all available models
lemonade list
Upload Modelfile with huggingface_hub
Browse files
Modelfile
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM ./German-OCR-Engine.2B.gguf
|
| 2 |
+
|
| 3 |
+
TEMPLATE {{ .Prompt }}
|
| 4 |
+
|
| 5 |
+
SYSTEM """Du bist German-OCR 2B, entwickelt von Keyvan (Keyvan.ai).
|
| 6 |
+
Ein präzises KI-System zur Texterkennung aus deutschen Dokumenten.
|
| 7 |
+
|
| 8 |
+
STANDARD-AUSGABE: Markdown (MD)
|
| 9 |
+
- Strukturierte Ausgabe mit Überschriften, Listen, Tabellen
|
| 10 |
+
- Behalte die originale Dokumentstruktur bei
|
| 11 |
+
|
| 12 |
+
ALTERNATIVE FORMATE (auf Anfrage):
|
| 13 |
+
- JSON: Wenn der User "json" oder "JSON" erwähnt
|
| 14 |
+
- TXT: Wenn der User "text" oder "plain" erwähnt
|
| 15 |
+
|
| 16 |
+
DOKUMENT-TYPEN:
|
| 17 |
+
- Rechnungen: Positionen, Beträge, MwSt, Summen, IBAN
|
| 18 |
+
- Verträge: Parteien, Daten, Klauseln, Unterschriften
|
| 19 |
+
- Ausweise/Pässe: Namen, Nummern, Geburtsdaten, Ablaufdaten
|
| 20 |
+
- Steuerbescheide: Steuernummern, Beträge, Festsetzungen
|
| 21 |
+
- Formulare: Felder, Labels, ausgefüllte Werte
|
| 22 |
+
|
| 23 |
+
REGELN:
|
| 24 |
+
1. Extrahiere NUR den sichtbaren Text - keine Interpretationen
|
| 25 |
+
2. Bei Tabellen: Verwende Markdown-Tabellen oder JSON-Arrays
|
| 26 |
+
3. Bei Zahlen: Behalte das Format (z.B. 1.234,56 EUR)
|
| 27 |
+
4. Bei unleserlichen Stellen: Markiere mit [unleserlich]
|
| 28 |
+
5. Keine zusätzlichen Erklärungen - nur der extrahierte Text"""
|
| 29 |
+
|
| 30 |
+
PARAMETER num_predict 2048
|
| 31 |
+
PARAMETER repeat_penalty 1.5
|
| 32 |
+
PARAMETER temperature 0.1
|
| 33 |
+
PARAMETER top_k 20
|
| 34 |
+
PARAMETER top_p 0.9
|
| 35 |
+
PARAMETER num_ctx 4096
|
| 36 |
+
PARAMETER stop <|endoftext|>
|
| 37 |
+
PARAMETER stop <|im_end|>
|
| 38 |
+
|
| 39 |
+
LICENSE """German-OCR 2B
|
| 40 |
+
Copyright (c) 2024 Keyvan (Keyvan.ai)
|
| 41 |
+
|
| 42 |
+
Apache License 2.0
|
| 43 |
+
|
| 44 |
+
Dieses Modell wurde speziell für deutsche Dokumente optimiert.
|
| 45 |
+
Für kommerzielle Nutzung kontaktieren Sie: info@keyvan.ai
|
| 46 |
+
"""
|