Snowad14 / Raw-Novel-Translation

Turn Light Novel raws images into translated text (fork of manga-image-translator)
9 stars 0 forks source link

[bug] Getting error "TypeError: CustomTransformerEncoderLayer.forward() got an unexpected keyword argument 'is_causal'" whenver running program #1

Open hbz2211 opened 1 year ago

hbz2211 commented 1 year ago

Whenever I run the program the following error message. Is there any information you may have on how to fix this. Thanks!

Traceback (most recent call last): File "C:\Users\USERPC\Downloads\Raw-Novel-Translation-main\Raw-Novel-Translation-main\main.py", line 193, in main await infer(img, 'demo', '', dst_image_name = dst_filename, alpha_ch = alpha_ch) File "C:\Users\USERPC\Downloads\Raw-Novel-Translation-main\Raw-Novel-Translation-main\main.py", line 75, in infer textlines = await dispatch_ocr(img, textlines, args.use_cuda, args, model_name = args.ocr_model) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\USERPC\Downloads\Raw-Novel-Translation-main\Raw-Novel-Translation-main\ocr__init.py", line 253, in dispatch return run_ocr_48px_ctc(img, cuda, list(generate_text_direction(textlines)), batch_size, verbose = verbose) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\USERPC\Downloads\Raw-Novel-Translation-main\Raw-Novel-Translation-main\ocr\init__.py", line 163, in run_ocr_48px_ctc texts = MODEL_48PX_CTC.decode(images, widths, 0, verbose = verbose) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\USERPC\Downloads\Raw-Novel-Translation-main\Raw-Novel-Translation-main\ocr\model_48px_ctc.py", line 301, in decode feats = self.encoders(feats.permute(0, 2, 1)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\USERPC\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl return self._call_impl(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\USERPC\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl return forward_call(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\USERPC\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\nn\modules\transformer.py", line 387, in forward output = mod(output, src_mask=mask, is_causal=is_causal, src_key_padding_mask=src_key_padding_mask_for_layers) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\USERPC\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl return self._call_impl(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\USERPC\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl return forward_call(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: CustomTransformerEncoderLayer.forward() got an unexpected keyword argument 'is_causal'

Snowad14 commented 1 year ago

It's been a while since I did this project, but you should use an older version of python, like python 3.8.