As there are 3 types of character set under the data directory i.e
charset_36.txt
charset_62.txt
charset_vn.txt
if I want to use other than charset_36.txt then what arguments need to change under config i.e
config = Config('configs/train_abinet.yaml')
Already tried with
(0): dataset_case_sensitive = True (1): dataset_charset_path = data/charset_62.txt (3): dataset_eval_case_sensitive = True
didn't get output in the capital later by changing and popping up with an error
`RuntimeError Traceback (most recent call last)
Cell In[2], line 1
----> 1 demo.main(input_folder=os.path.join('Test_img/test_img/'))
ABINET\ABINet\demo.py:104, in main(input_folder)
102 logging.info('Construct model.')
103 model = get_model(config).to(device)
--> 104 model = load(model, config.model_checkpoint, device=device)
105 charset = CharsetMapper(filename=config.dataset_charset_path,
106 max_length=config.dataset_max_length + 1)
108 if os.path.isdir(input_folder):
ABINET\ABINet\demo.py:66, in load(model, file, device, strict)
64 if set(state.keys()) == {'model', 'opt'}:
65 state = state['model']
---> 66 model.load_state_dict(state, strict=strict)
67 return model
abinet\abinet_env\lib\site-packages\torch\nn\modules\module.py:1604, in Module.load_state_dict(self, state_dict, strict)
1599 error_msgs.insert(
1600 0, 'Missing key(s) in state_dict: {}. '.format(
1601 ', '.join('"{}"'.format(k) for k in missing_keys)))
1603 if len(error_msgs) > 0:
-> 1604 raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
1605 self.class.name, "\n\t".join(error_msgs)))
1606 return _IncompatibleKeys(missing_keys, unexpected_keys)
RuntimeError: Error(s) in loading state_dict for ABINetIterModel:
size mismatch for vision.cls.weight: copying a param with shape torch.Size([37, 512]) from checkpoint, the shape in current model is torch.Size([63, 512]).
size mismatch for vision.cls.bias: copying a param with shape torch.Size([37]) from checkpoint, the shape in current model is torch.Size([63]).
size mismatch for language.proj.weight: copying a param with shape torch.Size([512, 37]) from checkpoint, the shape in current model is torch.Size([512, 63]).
size mismatch for language.cls.weight: copying a param with shape torch.Size([37, 512]) from checkpoint, the shape in current model is torch.Size([63, 512]).
size mismatch for language.cls.bias: copying a param with shape torch.Size([37]) from checkpoint, the shape in current model is torch.Size([63]).
size mismatch for alignment.cls.weight: copying a param with shape torch.Size([37, 512]) from checkpoint, the shape in current model is torch.Size([63, 512]).
size mismatch for alignment.cls.bias: copying a param with shape torch.Size([37]) from checkpoint, the shape in current model is torch.Size([63]).`
As there are 3 types of character set under the data directory i.e
config = Config('configs/train_abinet.yaml')
Already tried with(0): dataset_case_sensitive = True (1): dataset_charset_path = data/charset_62.txt (3): dataset_eval_case_sensitive = True
didn't get output in the capital later by changing and popping up with an error `RuntimeError Traceback (most recent call last) Cell In[2], line 1 ----> 1 demo.main(input_folder=os.path.join('Test_img/test_img/')) ABINET\ABINet\demo.py:104, in main(input_folder) 102 logging.info('Construct model.') 103 model = get_model(config).to(device) --> 104 model = load(model, config.model_checkpoint, device=device) 105 charset = CharsetMapper(filename=config.dataset_charset_path, 106 max_length=config.dataset_max_length + 1) 108 if os.path.isdir(input_folder):ABINET\ABINet\demo.py:66, in load(model, file, device, strict) 64 if set(state.keys()) == {'model', 'opt'}: 65 state = state['model'] ---> 66 model.load_state_dict(state, strict=strict) 67 return model
abinet\abinet_env\lib\site-packages\torch\nn\modules\module.py:1604, in Module.load_state_dict(self, state_dict, strict) 1599 error_msgs.insert( 1600 0, 'Missing key(s) in state_dict: {}. '.format( 1601 ', '.join('"{}"'.format(k) for k in missing_keys))) 1603 if len(error_msgs) > 0: -> 1604 raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( 1605 self.class.name, "\n\t".join(error_msgs))) 1606 return _IncompatibleKeys(missing_keys, unexpected_keys)
RuntimeError: Error(s) in loading state_dict for ABINetIterModel: size mismatch for vision.cls.weight: copying a param with shape torch.Size([37, 512]) from checkpoint, the shape in current model is torch.Size([63, 512]). size mismatch for vision.cls.bias: copying a param with shape torch.Size([37]) from checkpoint, the shape in current model is torch.Size([63]). size mismatch for language.proj.weight: copying a param with shape torch.Size([512, 37]) from checkpoint, the shape in current model is torch.Size([512, 63]). size mismatch for language.cls.weight: copying a param with shape torch.Size([37, 512]) from checkpoint, the shape in current model is torch.Size([63, 512]). size mismatch for language.cls.bias: copying a param with shape torch.Size([37]) from checkpoint, the shape in current model is torch.Size([63]). size mismatch for alignment.cls.weight: copying a param with shape torch.Size([37, 512]) from checkpoint, the shape in current model is torch.Size([63, 512]). size mismatch for alignment.cls.bias: copying a param with shape torch.Size([37]) from checkpoint, the shape in current model is torch.Size([63]).`