UniMERNet.yaml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. Global:
  2. use_gpu: True
  3. epoch_num: 40
  4. log_smooth_window: 10
  5. print_batch_step: 10
  6. save_model_dir: ./output/rec/unimernet/
  7. save_epoch_step: 5
  8. # evaluation is run every 37880 iterations after the 0th iteration
  9. eval_batch_step: [0, 10]
  10. cal_metric_during_train: True
  11. pretrained_model:
  12. checkpoints:
  13. save_inference_dir:
  14. use_visualdl: False
  15. infer_img: doc/datasets/pme_demo/0000013.png
  16. infer_mode: False
  17. use_space_char: False
  18. rec_char_dict_path: &rec_char_dict_path ppocr/utils/dict/unimernet_tokenizer
  19. input_size: &input_size [192, 672]
  20. max_seq_len: &max_seq_len 1024
  21. save_res_path: ./output/rec/predicts_unimernet_plus_config_latexocr.txt
  22. allow_resize_largeImg: False
  23. Optimizer:
  24. name: AdamW
  25. beta1: 0.9
  26. beta2: 0.999
  27. weight_decay: 0.05
  28. lr:
  29. name: LinearWarmupCosine
  30. learning_rate: 1e-4
  31. start_lr: 1e-5
  32. min_lr: 1e-8
  33. warmup_steps: 5000
  34. Architecture:
  35. model_type: rec
  36. algorithm: UniMERNet
  37. in_channels: 3
  38. Transform:
  39. Backbone:
  40. name: DonutSwinModel
  41. hidden_size : 1024
  42. num_layers: 4
  43. num_heads: [4, 8, 16, 32]
  44. add_pooling_layer: True
  45. use_mask_token: False
  46. Head:
  47. name: UniMERNetHead
  48. max_new_tokens: 1536
  49. decoder_start_token_id: 0
  50. temperature: 0.2
  51. do_sample: False
  52. top_p: 0.95
  53. encoder_hidden_size: 1024
  54. is_export: False
  55. length_aware: True
  56. Loss:
  57. name: UniMERNetLoss
  58. PostProcess:
  59. name: UniMERNetDecode
  60. rec_char_dict_path: *rec_char_dict_path
  61. Metric:
  62. name: LaTeXOCRMetric
  63. main_indicator: exp_rate
  64. cal_bleu_score: True
  65. Train:
  66. dataset:
  67. name: SimpleDataSet
  68. data_dir: ./train_data/UniMERNet/
  69. label_file_list: ["./train_data/UniMERNet/train_unimernet_1M.txt"]
  70. transforms:
  71. - UniMERNetImgDecode:
  72. input_size: *input_size
  73. - UniMERNetTrainTransform:
  74. - UniMERNetImageFormat:
  75. - UniMERNetLabelEncode:
  76. rec_char_dict_path: *rec_char_dict_path
  77. max_seq_len: *max_seq_len
  78. - KeepKeys:
  79. keep_keys: ['image', 'label', 'attention_mask']
  80. loader:
  81. shuffle: False
  82. drop_last: False
  83. batch_size_per_card: 7
  84. num_workers: 0
  85. collate_fn: UniMERNetCollator
  86. Eval:
  87. dataset:
  88. name: SimpleDataSet
  89. data_dir: ./train_data/UniMERNet/UniMER-Test/cpe
  90. label_file_list: ["./train_data/UniMERNet/test_unimernet_cpe.txt"]
  91. transforms:
  92. - UniMERNetImgDecode:
  93. input_size: *input_size
  94. - UniMERNetTestTransform:
  95. - UniMERNetImageFormat:
  96. - UniMERNetLabelEncode:
  97. max_seq_len: *max_seq_len
  98. rec_char_dict_path: *rec_char_dict_path
  99. - KeepKeys:
  100. keep_keys: ['image', 'label', 'attention_mask']
  101. loader:
  102. shuffle: False
  103. drop_last: False
  104. batch_size_per_card: 30
  105. num_workers: 0
  106. collate_fn: UniMERNetCollator