BallonsTranslator
BallonsTranslator copied to clipboard
Bug Report:
Version Info
Python version: 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)] Python executable: C:\Users\User-PC\AppData\Local\Programs\Python\Python310\python.exe Version: 1.4.0 Branch: dev Commit hash: d671bfb5d988dc7028708ac0f81223631f167658
Description of the Problem
when using mit48tx_ctc it will appear this window show OCR fail
Text Detector
None
OCR
None
Inpaint
None
Translator
None
Screenshot
Logs
Traceback (most recent call last):
File "C:\Users\User-PC\BallonsTranslator\ui\module_manager.py", line 386, in _imgtrans_pipeline
self.ocr.run_ocr(img, blk_list)
File "C:\Users\User-PC\BallonsTranslator\modules\ocr\base.py", line 42, in run_ocr
self._ocr_blk_list(img, blk_list, *args, **kwargs)
File "C:\Users\User-PC\BallonsTranslator\modules\ocr\ocr_mit.py", line 37, in _ocr_blk_list
return self.model(blk_list, regions, textblk_lst_indices, chunk_size=self.chunk_size)
File "C:\Users\User-PC\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\utils\_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
File "C:\Users\User-PC\BallonsTranslator\modules\ocr\mit48px_ctc.py", line 436, in __call__
texts = self.net.decode(images, widths, 0)
File "C:\Users\User-PC\BallonsTranslator\modules\ocr\mit48px_ctc.py", line 299, in decode
feats = self.encoders(feats.permute(0, 2, 1))
File "C:\Users\User-PC\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\nn\modules\module.py", line 1751, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "C:\Users\User-PC\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\nn\modules\module.py", line 1762, in _call_impl
return forward_call(*args, **kwargs)
File "C:\Users\User-PC\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\nn\modules\transformer.py", line 514, in forward
output = mod(
File "C:\Users\User-PC\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\nn\modules\module.py", line 1751, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "C:\Users\User-PC\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\nn\modules\module.py", line 1762, in _call_impl
return forward_call(*args, **kwargs)
File "C:\Users\User-PC\BallonsTranslator\modules\ocr\mit48px_ctc.py", line 102, in forward
x = x + self._sa_block(self.norm1(x), src_mask, src_key_padding_mask)
File "C:\Users\User-PC\BallonsTranslator\modules\ocr\mit48px_ctc.py", line 113, in _sa_block
x = self.self_attn(self.pe(x), self.pe(x), x, # no PE for value
File "C:\Users\User-PC\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\nn\modules\module.py", line 1751, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "C:\Users\User-PC\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\nn\modules\module.py", line 1762, in _call_impl
return forward_call(*args, **kwargs)
File "C:\Users\User-PC\BallonsTranslator\modules\ocr\mit48px_ctc.py", line 30, in forward
x = x + self.pe[:, offset: offset + x.size(1), :]
RuntimeError: The size of tensor a (2057) must match the size of tensor b (2048) at non-singleton dimension 1
Additional Information
No response