fine_tunning scripts
Thank you very much for your efforts in making Arabic hand written manuscript texts machine-readable. It is especially valuable that you are sharing these models as open access. Would it be possible for you to share the fine-tuning scripts for the "sherif1313/Arabic-GLM-OCR-v2" and "Arabic-Qwen3.5-OCR-v4" models with me? gokhannusta@gmail.com
Of course, I'd be delighted to provide training for the [sherif1313/Arabic-Qwen3.5-OCR-v4]... [(https://github.com/sherif1313/Arabic-English-handwritten-OCR-v3/blob/main/train%2Cpy)] There are some modifications I haven't added yet, specifically related to modifying the model itself. ... I haven't added the [sherif1313/Arabic-GLM-OCR-v2] yet.
...and I will put it on a new page on [(https://github.com/sherif1313)].
I am currently working on a very large Arabic model. If you would like to join me and we can do a training workshop, I would be happy to have you.
Thank you very much for invatitation, I would like to support you, actually I fine-tuned your model and it really made good performance for Ottoman Turkish HTR: https://github.com/gusta-bib/ottoman-htr
I am from Turkiye, I dont know to speak or understand arabic but I would maybe contribute to you fine-tunning efforts. By the way I couldnt find fine-tunning script for "Arabic-Qwen3.5-OCR-v4" in your github.
you can text me on google chat: gokhannusta@gmail.com
Thank you, brother, for your interest. The main change is Qwen3_5ForConditionalGeneration instead of 2_5, and also increasing the LoRa to 64. Unfortunately, I cannot update the OCR models at the moment due to my current project commitments. If you need anything, I'm here to help.
I've seen your page, and it's wonderful work you're doing. With my experience working with Turkish manuscripts, I find them easier, especially the Naskh script. However, I sometimes find Ottoman calligraphy complex to understand. Perhaps you could focus on simpler scripts now to better understand the model, as my model, sherif1313/Arabic-Qwen3.5-OCR-v4, is best for printed copies. If you want to improve it, you should increase the resolution beyond 64 perhaps 128 or more. Thank you again, my brother, for your interest in Turkish heritage books, as they are a significant part of Islamic heritage.
God willing, after completing my current project, I will continue improving OCR models and share them together.
From the training analysis, "qkv," "fc1," "fc2," and "proj" were found. This addition is not helpful. I want to clarify that you should not link Validation Loss in training because handwriting has its own specific handling And the greatest reliance is on CER and WER
I've seen the training font samples and they're fantastic.
Samples of old training must be added to the new training to prevent disastrous forgetting.
Thank you for the detailed feedback, I really appreciate you taking the time.
Regarding the vision-layer LoRA targets (qkv, fc1, fc2, proj) could you share a bit more about what you observed when comparing with vs. without them? I'm curious whether it was a CER/WER difference, training instability, or something else. Since VLMs already come with a pretrained vision encoder, I'd love to understand your reasoning for why adapting it further wasn't helpful in your experiments.
On the CER/WER vs. validation loss point completely agree, and I actually already switched to CER-based early stopping in my later training run (https://github.com/gusta-bib/ottoman-htr/tree/main/training_and_evaluation)), which helped noticeably.
Thanks again for sharing your work openly, it's been a great starting point for this.
It's essential to maintain the LORِA because any change will alter the model and training. Changing a part of the model will result in lost knowledge. Start with a large LORA and then decrease it; don't do the opposite.
Regarding optim="adamw_torch" and finally optim="paged_adamw_8bit", it's best if you're working with a 24GB card or higher to use adamw_torch because handwriting requires significant resources. As for learning_rate, start with 3e-5 or 4e-5 and then decrease it, not the other way around. These qkv, fc1, fc2, and proj are for other models like LAMA.
If you want a radical change, merge the old LOR with the model and start with a new LOR. You must add at least 20% of the old data; this is crucial for radical model improvement.
If I find anything else, I'll let you know, God willing.
Use these settings to optimize the model: image = sample["image"]
If image.width > MAX_IMAGE_SIZE or image.height > MAX_IMAGE_SIZE:
image.thumbnail((MAX_IMAGE_SIZE, MAX_IMAGE_SIZE), Image.Resampling.LANCZOS)
text = sample["text"]
width, height = image.size
new_width = ((width + 31) // 32) * 32
new_height = ((height + 31) // 32) * 32
image = image.resize((new_width, new_height), Image.LANCZOS)
Instead of 62 . 61 if you have a powerful machine`