Training#

The pretrained models work well on common printed documents. When your documents are different (another language, handwriting, unusual fonts, specific layouts, fields to extract), fine-tuning a model on a few hundred annotated samples usually brings a large improvement.

The workflow#

  1. Collect and annotate a representative sample of your documents, e.g. with the docTR Labeler.
  2. Format the data as an images/ folder and a labels.json file, following the format of each task.
  3. Train with the reference script of the task, starting from the pretrained weights.
  4. Evaluate the checkpoint on held-out data with the evaluation script.
  5. Load your checkpoint into a predictor, alongside the pretrained models.
  6. Share it on the Hugging Face Hub, if you like.

In this section#

Datasets

Built-in public datasets, synthetic data generators and loaders for your own data.

Datasets
Training a model

Data formats, training scripts, multi-GPU and mixed precision, for every task.

Training a model
Using your trained models

Load your checkpoints into the OCR, KIE and task-specific predictors.

Using your trained models
Sharing models

Publish and load models with the Hugging Face Hub, and browse community models.

Sharing models