Closed lyminhuit closed 1 year ago
If you train the model with the below option
--character 'aàảãáạăằẳẵắặâầẩẫấậbcdđeèẻẽéẹêềểễếệfghiìỉĩíịjklmnoòỏõóọôồổỗốộơờởỡớợpqrstuùủũúụưừửữứựvwxyỳỷỹýỵz0123456789' \
, you also need it to predict.
Thus, try this command
!python demo.py \
--model_name TRBA \
--character 'aàảãáạăằẳẵắặâầẩẫấậbcdđeèẻẽéẹêềểễếệfghiìỉĩíịjklmnoòỏõóọôồổỗốộơờởỡớợpqrstuùủũúụưừửữứựvwxyỳỷỹýỵz0123456789' \
--image_folder /content/drive/MyDrive/UIT_CHALLENGE_2022/result/crop_img \
--saved_model /content/drive/MyDrive/UIT_CHALLENGE_2022/src/STR-Fewer-Labels/best_score_new_reg.pth
it working, thank you sir!!
Hi, I have trained on Vietnamese custom dataset with this command:
after 50k iters, i predicted with best_score.pth by this command:
The error:
of tokens and characters: 99
model input parameters 32 100 20 3 512 256 99 25 TPS ResNet BiLSTM Attn loading pretrained model from /content/drive/MyDrive/UIT_CHALLENGE_2022/src/STR-Fewer-Labels/best_score_new_reg.pth Traceback (most recent call last): File "demo.py", line 194, in
demo(opt)
File "demo.py", line 47, in demo
model.load_state_dict(torch.load(opt.saved_model, map_location=device))
File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1667, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for DataParallel:
size mismatch for module.Prediction.generator.weight: copying a param with shape torch.Size([108, 256]) from checkpoint, the shape in current model is torch.Size([99, 256]).
size mismatch for module.Prediction.generator.bias: copying a param with shape torch.Size([108]) from checkpoint, the shape in current model is torch.Size([99]).
size mismatch for module.Prediction.char_embeddings.weight: copying a param with shape torch.Size([108, 256]) from checkpoint, the shape in current model is torch.Size([99, 256]).
Pls helps, thanks!