wenwenyu / PICK-pytorch

Code for the paper "PICK: Processing Key Information Extraction from Documents using Improved Graph Learning-Convolutional Networks" (ICPR 2020)
https://arxiv.org/abs/2004.07464
MIT License
553 stars 191 forks source link

Issue while Loading trained model #47

Closed karthikesh2020 closed 3 years ago

karthikesh2020 commented 3 years ago

I trained model for a while & cancelled training Now i'm trying it test. i'm getting below issue. kindly please help. thanks in advance

Command: !python test.py --checkpoint saved/models/PICK_Default/test_1012_064804/model_best.pth \ --boxes_transcripts {out_box_path} \ --images_path {out_img_path} --output_folder /content/output/ \ --gpu 0 --batch_size 2

Error: Loading checkpoint: saved/models/PICK_Default/test_1012_064804/model_best.pth with saved mEF 0.0000 ...

RuntimeError: Error(s) in loading state_dict for PICKModel: size mismatch for decoder.bilstm_layer.mlp.mlp.0.weight: copying a param with shape torch.Size([49, 1024]) from checkpoint, the shape in current model is torch.Size([11, 1024]). size mismatch for decoder.bilstm_layer.mlp.mlp.0.bias: copying a param with shape torch.Size([49]) from checkpoint, the shape in current model is torch.Size([11]). size mismatch for decoder.crf_layer.transitions: copying a param with shape torch.Size([49, 49]) from checkpoint, the shape in current model is torch.Size([11, 11]). size mismatch for decoder.crf_layer._constraint_mask: copying a param with shape torch.Size([51, 51]) from checkpoint, the shape in current model is torch.Size([13, 13]). size mismatch for decoder.crf_layer.start_transitions: copying a param with shape torch.Size([49]) from checkpoint, the shape in current model is torch.Size([11]). size mismatch for decoder.crf_layer.end_transitions: copying a param with shape torch.Size([49]) from checkpoint, the shape in current model is torch.Size([11]).

tengerye commented 3 years ago

Hi, @karthikesh2020 , please check your config file. The numbers of classes for train and test are likely to be different.

karthikesh2020 commented 3 years ago

Hi, @karthikesh2020 , please check your config file. The numbers of classes for train and test are likely to be different.

karthikesh2020 commented 3 years ago

Hi, @karthikesh2020 , please check your config file. The numbers of classes for train and test are likely to be different.

Thank you so much @tengerye, It solved the problem.