Instructions to use oddadmix/Khanandeh-0.1-Persian-OCR-2B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use oddadmix/Khanandeh-0.1-Persian-OCR-2B-Instruct with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/qwen2-vl-2b-instruct-unsloth-bnb-4bit") model = PeftModel.from_pretrained(base_model, "oddadmix/Khanandeh-0.1-Persian-OCR-2B-Instruct") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Unsloth Studio
How to use oddadmix/Khanandeh-0.1-Persian-OCR-2B-Instruct 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 oddadmix/Khanandeh-0.1-Persian-OCR-2B-Instruct 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 oddadmix/Khanandeh-0.1-Persian-OCR-2B-Instruct to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for oddadmix/Khanandeh-0.1-Persian-OCR-2B-Instruct to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="oddadmix/Khanandeh-0.1-Persian-OCR-2B-Instruct", max_seq_length=2048, )
TypeError: Incorrect format used for image
Hi,
Thanks for sharing.
I have used bellow script but raised error incorrect image format:
from transformers import pipeline
generator = pipeline("image-to-text", model="oddadmix/Khanandeh-0.1-Persian-OCR-2B-Instruct")
image_path = "https://www.omniglot.com/images/langsamples/udhr_persian.gif"
instruction = """Analyze the text in the provided image. Extract all readable text content
and present it in a structured Markdown format that is clear, concise,
and well-organized. Ensure proper formatting (e.g., headings, lists, or
code blocks) as necessary to represent the content effectively.
No extra explanation needed"""
messages = [
{
"role": "user",
"content": [
{
"type": "image",
"image": image_path,
},
{"type": "text", "text": instruction},
],
}
]
output = generator(messages, max_new_tokens=128)[0]
Please use the same Qari notebook and change the model name
https://colab.research.google.com/github/NAMAA-ORG/public-notebooks/blob/main/Qari_Free_Colab.ipynb
I didn't get a chance to work on the model card yet.
What specifications does train dataset of 'Khanandeh' have?
Ofcourse this is better than original Qwen but for the bellow text gemma3-27b was perfect.
- Althoug I am focused on handwritting, Do you think it is important to learn printed document before handwritting?
- I would be thankfull if you share summary of 'Khanandeh' model dataset and detail of creating such dataset.
Thanks in advanced
Output:
دیناست ما شامل ۱۱ فونت ایجاد شده اند.
Do you have a dataset for handwriting? I would try to find a font that is super close to handwriting as a start and generate a dataset from it.
It all depends on the use case. For example, if I want to have a model with excellent handwriting capabilities, I would have the data exclusive to handwriting. If you are looking to build a model that can balance recognition, I would mix the dataset to be able to cover all cases.
Please let me know more about your use case.
Hello everone,
This is the best persian dataset which contains samples similar to handwriting.
https://huggingface.co/datasets/hezarai/parsynth-ocr-200k
But these are one line sentences. It is better to have samples with one paragraph or even full page text to finetune VLM.
@raminh921
here is the dataset
oddadmix/Khanandeh-0.1-Persian-dataset
Great work. Thanks for sharing this dataset.
Do you have any evaluation result on the testset?
I didn't get a chance to work on full evaluation results.
I will try to do it in the next weeks
