mittagessen / kraken

OCR engine for all the languages
http://kraken.re
Apache License 2.0
750 stars 131 forks source link

Exception when using the reduceonplateau parameter in segtrain command #635

Closed fattynoparents closed 3 months ago

fattynoparents commented 3 months ago

When trying to use --schedule reduceonplateau I get an exception:

│ /kraken/lib/python3.11/site-packages/kraken/lib/train.py:1117 in     │
│ lr_scheduler_step                                                                                │
│                                                                                                  │
│   1114 │   │   │   │   scheduler.step()                                                          │
│   1115 │   │   │   # step every other scheduler epoch-wise                                       │
│   1116 │   │   │   elif self.trainer.is_last_batch:                                              │
│ ❱ 1117 │   │   │   │   scheduler.step()                                                          │
│   1118                                                                                           │
│   1119                                                                                           │
│   1120 def _configure_optimizer_and_lr_scheduler(hparams, params, len_train_set=None, loss_trac  │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: ReduceLROnPlateau.step() missing 1 required positional argument: 'metrics'

The command is:

 ketos segtrain -d cuda:0 -f xml -t output.txt --resize both --schedule reduceonplateau -i ~/path/to/model -o output/model --workers 48

and the exception is raised after the first validation step.