# Train

Use the `teklia-dan train document` command to train a new DAN model. It is able to train a DAN model at line or document-level and evaluate it.

## Examples

### Document

To train DAN on documents:

1. Set your training configuration in `dan/ocr/document/train.py`. Refer to the [dedicated section](parameters.md) for a description of parameters.
1. Run `teklia-dan train document`.
1. Look into evaluation results in the `output` folder:
    - `checkpoints` contains model weights for the last trained epoch and for the epoch giving the best valid CER.
    - `results` contains the tensorboard log file, the parameters file, and the evaluation results for the best epoch.

### Line

To train DAN on lines, run `teklia-dan train document` with a line dataset.

## Additional pages

- [Jean Zay tutorial](jeanzay.md)
- [Data augmentation](augmentation.md)