Fix Bad OCR: Fine-Tune DeepSeek-V2 on Your Own Data (Unsloth)
๐ Colab tutorial: Fine-tune DeepSeek-OCR (3B) with Unsloth + LoRA to improve handwriting & document OCR. In a demo we cut CER from 23% to 6% (~74% relative) and show a brief look at a small Persian OCR set.
Notebook: https://docs.unsloth.ai/new/deepseek-ocr-run-and-fine-tune
What youโll learn
DeepSeek-OCR overview (layout โ vision tokens; fast inference)
Colab setup (Transformers, PyTorch, Unsloth)
Baseline inference + CER evaluation
Dataset formatting (image + instruction, user/assistant turns)
LoRA/PEFT fine-tuning via FastVisionModel.get_peft_model
Training with Trainer, monitoring loss (quick 60-step run)
Post-training evaluation (demo sample + Persian examples)
Saving/pushing LoRA adapters to Hugging Face Hub
Resources
Unsloth: https://github.com/unslothai/unsloth
DeepSeek-OCR (HF): https://huggingface.co/unsloth/DeepSeek-OCR
Persian OCR dataset: https://huggingface.co/datasets/hezARAI/parsynth-ocr-200k
Chapters
00:00 Intro โ What is DeepSeek-OCR?
01:04 Fine-tuning results (demo & Persian set overview)
02:06 Colab notebook walkthrough
02:18 Install dependencies (Unsloth)
02:32 Load unsloth/DeepSeek-OCR
03:00 Baseline eval (CER on sample)
03:57 Test on a custom screenshot
04:43 Prep for LoRA fine-tuning
05:14 Data prep & formatting
06:22 Train (60 steps)
07:08 Evaluate โ 23%โ6% CER (demo sample)
07:50 Save LoRA / push to HF Hub
08:10 Outro
Note: Results shown include a single-sample demo (23%โ6% CER) and a brief, small Persian OCR evaluation. Expect variability on your data/language.
๐ฌ What should I fine-tune next? Comment below.
๐ Like & subscribe if this helped!
#DeepSeekOCR #Unsloth #LoRA
Watch on YouTube โ
(saves to browser)
Sign in to unlock AI tutor explanation ยท โก30
More on: Fine-tuning LLMs
View skill โRelated AI Lessons
Chapters (13)
Intro โ What is DeepSeek-OCR?
1:04
Fine-tuning results (demo & Persian set overview)
2:06
Colab notebook walkthrough
2:18
Install dependencies (Unsloth)
2:32
Load unsloth/DeepSeek-OCR
3:00
Baseline eval (CER on sample)
3:57
Test on a custom screenshot
4:43
Prep for LoRA fine-tuning
5:14
Data prep & formatting
6:22
Train (60 steps)
7:08
Evaluate โ 23%โ6% CER (demo sample)
7:50
Save LoRA / push to HF Hub
8:10
Outro
๐
Tutor Explanation
DeepCamp AI