Permission for private offline use

#1
by ofsha - opened

Hi @cyttic ,

I'm interested in using your DiffusionPen-matan model for a personal Hebrew handwriting project.

Would it be okay to download the model weights and run them entirely offline for private, noncommercial experiments?

I couldn't find a license for the model weights, so I wanted to ask for your permission before proceeding.

Thank you!

Hi,

Thanks for asking. Yes, you're welcome to download the weights and run them offline for private, noncommercial experiments.

Please note that the model is a fine-tune of the original DiffusionPen (Nikolaidou et al.), so its original license and terms also apply, and it was trained on Hebrew handwriting data that has its own terms. If you publish anything based on it, please cite DiffusionPen and mention this repo.

Good luck with your project!

Hi @cyttic ,

Thank you very much for your kind response and for granting permission to use the model.

I truly appreciate your generosity and the work you've put into making this available.

Of course, I'll fully respect the original DiffusionPen license and all applicable dataset terms.

Thanks again for your time and clarification!

Hi @cyttic ,

Thanks again for your help!

I noticed your pipeline references diffusionpen-matan-ft, test-diff-pen, and diffpen-hebrew2, but I couldn't find accessible copies.

Could you point me to the relevant checkpoint and inference/preprocessing code, or a minimal runnable example?

Thanks!

Hi,

Sorry for the confusion: test-diff-pen and diffpen-hebrew2 are local working folders on my machine, not published repos. The first is a fork of the official DiffusionPen code (https://github.com/koninik/DiffusionPen);
the second holds only my data-building scripts. I've now packaged everything needed for inference into one public repo:

https://huggingface.co/cyttic/diffusionpen-matan-ft

  • ema_ckpt.pt is the checkpoint to sample with (491 writer styles, Hebrew letters only, one word per image).
  • sample.py is a minimal runnable example. The repo also includes the model code, the style encoder and the vocabulary/writer maps.
  • Reference style crops: https://huggingface.co/datasets/cyttic/matan-hebrew-handwriting-words (the script downloads them automatically)

Usage:

pip install -r requirements.txt
python sample.py --text "ืฉืœื•ื ืขื•ืœื" --style w100 --n 2
python sample.py --text "ืฉืœื•ื" --refs r1.png r2.png r3.png r4.png r5.png # your own style references

On the first run, everything (including the SD-1.5 VAE and CANINE) downloads from the Hugging Face Hub. After that it works offline. It runs on GPU, or on CPU (slowly).

One important caveat: this model hallucinates a lot. When each word is generated once (which is what sample.py does), the mean CER measured by our Hebrew TrOCR across 50 writers is about 0.40. Only 1 writer in 50 came
out clean. In our pipeline we therefore generate 20 candidates per word and let a recognizer pick the best one, which brings the CER down to about 0.05. I recommend doing the same: generate several candidates and filter
them with an HTR model.

Best,

Thank you so much for taking the time to package and share everything!

I was able to get the model running successfully using your instructions. I really appreciate your help and the effort you put into making the checkpoint and inference code available.

Thanks again!

Hi @cyttic ,
Thanks again! One more question: I'm trying to run cyttic/exp10-trocr-hebrew-matan-full to pick
the best candidates, as you recommended. Even on word crops from matan-hebrew-handwriting-words,
I get 0/50 exact reads (CER ~2.5), with transformers 5.0.0. Could you share the exact inference
snippet you use: processor/tokenizer, image preprocessing (size, RGB, padding), and the generate()
settings? Thank you!

Sign up or log in to comment