Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Open
hbz2211 opened this issue Oct 7, 2023 · 1 comment

Comments

@hbz2211
Copy link

hbz2211 commented Oct 7, 2023

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
Copy link
Owner

Snowad14 commented Oct 8, 2023

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

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants