How to use from the
Use from the
Transformers library
# 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]:]))
Quick Links

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

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.

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.
Downloads last month
3
Safetensors
Model size
9B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for jolovicdev/princip-v0.2

Finetuned
Qwen/Qwen3.5-9B
Adapter
(529)
this model