Image-Text-to-Text
Transformers
Safetensors
Old Church Slavonic
Serbian
qwen3_5
church-slavonic
old-church-slavonic
serbian
translation
ocr
htr
manuscripts
qwen3.5
lora
conversational
Instructions to use jolovicdev/princip-v0.2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use jolovicdev/princip-v0.2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="jolovicdev/princip-v0.2") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("jolovicdev/princip-v0.2") model = AutoModelForMultimodalLM.from_pretrained("jolovicdev/princip-v0.2", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use jolovicdev/princip-v0.2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "jolovicdev/princip-v0.2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "jolovicdev/princip-v0.2", "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/jolovicdev/princip-v0.2
- SGLang
How to use jolovicdev/princip-v0.2 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 "jolovicdev/princip-v0.2" \ --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": "jolovicdev/princip-v0.2", "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 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 "jolovicdev/princip-v0.2" \ --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": "jolovicdev/princip-v0.2", "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" } } ] } ] }' - Docker Model Runner
How to use jolovicdev/princip-v0.2 with Docker Model Runner:
docker model run hf.co/jolovicdev/princip-v0.2
| license: cc-by-nc-sa-4.0 | |
| base_model: Qwen/Qwen3.5-9B | |
| library_name: transformers | |
| pipeline_tag: image-text-to-text | |
| tags: | |
| - church-slavonic | |
| - old-church-slavonic | |
| - serbian | |
| - translation | |
| - ocr | |
| - htr | |
| - manuscripts | |
| - qwen3.5 | |
| - lora | |
| language: | |
| - cu | |
| - sr | |
| # Princip V0.2 | |
| Reads lines of Church Slavonic manuscript and translates them into Serbian. Three tasks: | |
| transcription from an image, translation from an image, and translation from text. | |
| ## Languages | |
| Source is **Church Slavonic of the Russian recension**, the language of the service books | |
| in current liturgical use in the Serbian Orthodox Church, together with **Old Church | |
| Slavonic** from the 10th-11th century canon. Target is Serbian in the register of the | |
| 1868 Daničić translation. | |
| Serbian-recension Church Slavonic (srpskoslovenski) is not represented. See Limitations. | |
| ## Tasks | |
| | task | input | output | | |
| |---|---|---| | |
| | `i2t` | image of a single text line | transcription | | |
| | `i2s` | image of a single text line | Serbian translation | | |
| | `t2s` | Church Slavonic text | Serbian translation | | |
| Trained on **single-line crops**, not whole pages. Segment a folio into lines first. | |
| ## Usage | |
| ```python | |
| import torch | |
| from transformers import AutoProcessor, AutoModelForImageTextToText | |
| model = AutoModelForImageTextToText.from_pretrained( | |
| "jolovicdev/princip-v0.2", dtype=torch.bfloat16, device_map="cuda" | |
| ) | |
| processor = AutoProcessor.from_pretrained("jolovicdev/princip-v0.2") | |
| ``` | |
| Prompts, used verbatim: | |
| - `Prevedi sledeci tekst sa staroslovenskog na srpski:\n{text}` | |
| - image + `Transkribuj staroslovenski tekst sa ove slike.` | |
| - image + `Prevedi tekst sa ove slike na srpski.` | |
| **Close the thinking block before generating.** The chat template opens one and leaves it | |
| open; if you do not close it the model writes reasoning instead of the answer. | |
| ```python | |
| text = processor.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True) | |
| if text.rstrip().endswith("<think>"): | |
| text += "\n</think>\n\n" | |
| ``` | |
| This applies to llama.cpp and any OpenAI-compatible server too. | |
| ## Results | |
| Held-out data, greedy decoding. | |
| | task | metric | score | | |
| |---|---|---| | |
| | translation from text | chrF | 46.9 | | |
| | translation from image | chrF | 44.8 | | |
| | transcription, real manuscript folios | CER | 0.117 | | |
| | transcription, rendered lines | CER | 0.023 | | |
| On manuscripts absent from training (Codex Assemanianus, Savvina kniga) translation | |
| scores chrF 52.6, so the model generalises beyond the hands it was trained on. | |
| Roughly 36% of rare words, mostly proper nouns, survive into the translation. The model | |
| can produce fluent Serbian that misstates the source; verify anything that matters. | |
| ## Training | |
| LoRA fine-tune of `Qwen/Qwen3.5-9B`, r=32, 1 epoch, bf16, on 4x RTX 5090. 96.9M trainable | |
| parameters covering the attention and MLP projections, the vision merger, and both | |
| embedding matrices. Data: 81k samples across the three tasks, drawn from a parallel corpus | |
| of biblical, psalter and liturgical Church Slavonic aligned to Serbian, plus 49.7k line | |
| images combining real folio crops with rendered lines. Images are split by folio, so no | |
| page appears in both training and evaluation. | |
| ## Sources and licensing | |
| | source | licence | | |
| |---|---| | |
| | Daničić-Karadžić Serbian Bible 1868 | public domain | | |
| | Elizabeth Bible 1757 | public domain | | |
| | PROIEL Codex Marianus | CC BY-NC-SA 4.0 | | |
| | TOROT (Zographensis, Psalterium Sinaiticum, Suprasliensis, Euchologium, Kiev Missal) | CC BY-NC-SA 4.0 | | |
| | cu-books liturgical texts | MIT | | |
| | Serbian Mineja, SPC edition (svetosavlje.org) | no explicit licence, research use | | |
| | Codex Suprasliensis folio images (suprasliensis.obdurodon.org) | CC BY-NC-SA 3.0 | | |
| | Menaion, Monomakh, Fedorovsk, Pomorsky fonts | SIL OFL | | |
| The PROIEL and TOROT treebanks are non-commercial, so this model is released under | |
| **CC BY-NC-SA 4.0**. | |
| ## Limitations | |
| - **Serbian recension is absent.** Medieval Serbian manuscripts such as Miroslavljevo | |
| jevanđelje use orthographic conventions the model has not seen. Expect degraded results. | |
| - **Line crops only.** Whole pages are out of distribution. | |
| - **Parchment and print only.** Carved stone, epigraphy and heavily degraded surfaces are | |
| outside the training distribution. | |
| - **Glagolitic is not supported.** The Old Church Slavonic sources are Glagolitic | |
| manuscripts in Cyrillic transcription; the model has not seen Glagolitic script. | |
| - **It does not reliably refuse out-of-domain input.** Shown Cyrillic that is not Church | |
| Slavonic, it will usually attempt a transcription rather than decline. | |
| - **Serbian register** follows the 1868 Daničić translation, not contemporary Serbian. | |
| - **Non-commercial use only.** | |