Hi !
When length average is True, an error is thrown in init.py because of a division between int and float.
Traceback (most recent call last): File "/home/tbelos/anaconda3/lib/python3.6/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/home/tbelos/anaconda3/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/space_sde/tbelos/git/structured-ocr/socr/__main__.py", line 16, in <module> text_recognizer_main(sys.argv[2:]) File "/space_sde/tbelos/git/structured-ocr/socr/text_recognizer.py", line 230, in main line_ctc.train(args.lr) File "/space_sde/tbelos/git/structured-ocr/socr/text_recognizer.py", line 68, in train self.trainer.train(train_database, callback=lambda: self.trainer_callback()) File "/space_sde/tbelos/git/structured-ocr/socr/utils/trainer/trainer.py", line 113, in train self.do_one_epoch(loader, batch_size, csv_file) File "/space_sde/tbelos/git/structured-ocr/socr/utils/trainer/trainer.py", line 157, in do_one_epoch loss_value = self.loss.forward(outputs, self.loss.process_labels(labels, is_cuda=is_cuda)) File "/space_sde/tbelos/git/structured-ocr/socr/models/loss/ctc_text_loss.py", line 46, in forward return self.loss(inputs.contiguous(), inputs_width, labels, labels_length) File "/home/tbelos/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in __call__ result = self.forward(*input, **kwargs) File "/home/tbelos/anaconda3/lib/python3.6/site-packages/warpctc-0.0.0-py3.6-linux-x86_64.egg/warpctc/__init__.py", line 102, in forward torch.is_grad_enabled()) File "/home/tbelos/anaconda3/lib/python3.6/site-packages/warpctc-0.0.0-py3.6-linux-x86_64.egg/warpctc/__init__.py", line 25, in forward costs = costs / label_lengths RuntimeError: Expected object of type torch.FloatTensor but found type torch.IntTensor for argument #2 'other'
Hi ! When length average is True, an error is thrown in init.py because of a division between int and float.
Traceback (most recent call last): File "/home/tbelos/anaconda3/lib/python3.6/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/home/tbelos/anaconda3/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/space_sde/tbelos/git/structured-ocr/socr/__main__.py", line 16, in <module> text_recognizer_main(sys.argv[2:]) File "/space_sde/tbelos/git/structured-ocr/socr/text_recognizer.py", line 230, in main line_ctc.train(args.lr) File "/space_sde/tbelos/git/structured-ocr/socr/text_recognizer.py", line 68, in train self.trainer.train(train_database, callback=lambda: self.trainer_callback()) File "/space_sde/tbelos/git/structured-ocr/socr/utils/trainer/trainer.py", line 113, in train self.do_one_epoch(loader, batch_size, csv_file) File "/space_sde/tbelos/git/structured-ocr/socr/utils/trainer/trainer.py", line 157, in do_one_epoch loss_value = self.loss.forward(outputs, self.loss.process_labels(labels, is_cuda=is_cuda)) File "/space_sde/tbelos/git/structured-ocr/socr/models/loss/ctc_text_loss.py", line 46, in forward return self.loss(inputs.contiguous(), inputs_width, labels, labels_length) File "/home/tbelos/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in __call__ result = self.forward(*input, **kwargs) File "/home/tbelos/anaconda3/lib/python3.6/site-packages/warpctc-0.0.0-py3.6-linux-x86_64.egg/warpctc/__init__.py", line 102, in forward torch.is_grad_enabled()) File "/home/tbelos/anaconda3/lib/python3.6/site-packages/warpctc-0.0.0-py3.6-linux-x86_64.egg/warpctc/__init__.py", line 25, in forward costs = costs / label_lengths RuntimeError: Expected object of type torch.FloatTensor but found type torch.IntTensor for argument #2 'other'