Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

按照正常操作,没办法正常运行,是环境导致的吗? #17

Closed
Ai-Sherry opened this issue Sep 9, 2021 · 7 comments
Closed

Comments

@Ai-Sherry
Copy link

Highway.forward: return type <class 'torch.Tensor'> is not a <class 'NoneType'>

@Ai-Sherry
Copy link
Author

File "/root/mashiqian/KeyWord/SIFRank_zh-master/key_word2.py", line 5, in
from embeddings import sent_emb_sif, word_emb_elmo
File "/root/mashiqian/KeyWord/SIFRank_zh-master/embeddings/word_emb_elmo.py", line 6, in
from elmoformanylangs import Embedder
File "/root/mashiqian/miniconda/lib/python3.9/site-packages/elmoformanylangs/init.py", line 2, in
from .elmo import Embedder
File "/root/mashiqian/miniconda/lib/python3.9/site-packages/elmoformanylangs/elmo.py", line 12, in
from .frontend import create_one_batch
File "/root/mashiqian/miniconda/lib/python3.9/site-packages/elmoformanylangs/frontend.py", line 10, in
from .modules.token_embedder import ConvTokenEmbedder, LstmTokenEmbedder
File "/root/mashiqian/miniconda/lib/python3.9/site-packages/elmoformanylangs/modules/token_embedder.py", line 8, in
from .highway import Highway
File "/root/mashiqian/miniconda/lib/python3.9/site-packages/elmoformanylangs/modules/highway.py", line 12, in
class Highway(torch.nn.Module):
File "/root/mashiqian/miniconda/lib/python3.9/site-packages/elmoformanylangs/modules/highway.py", line 47, in Highway
def forward(self, inputs: torch.Tensor) -> torch.Tensor: # pylint: disable=arguments-differ
File "/root/mashiqian/miniconda/lib/python3.9/site-packages/overrides/overrides.py", line 88, in overrides
return _overrides(method, check_signature, check_at_runtime)
File "/root/mashiqian/miniconda/lib/python3.9/site-packages/overrides/overrides.py", line 114, in _overrides
_validate_method(method, super_class, check_signature)
File "/root/mashiqian/miniconda/lib/python3.9/site-packages/overrides/overrides.py", line 135, in _validate_method
ensure_signature_is_compatible(super_method, method, is_static)
File "/root/mashiqian/miniconda/lib/python3.9/site-packages/overrides/signature.py", line 93, in ensure_signature_is_compatible
ensure_return_type_compatibility(super_type_hints, sub_type_hints, method_name)
File "/root/mashiqian/miniconda/lib/python3.9/site-packages/overrides/signature.py", line 287, in ensure_return_type_compatibility
raise TypeError(
TypeError: Highway.forward: return type <class 'torch.Tensor'> is not a <class 'NoneType'>.

@sunyilgdx
Copy link
Owner

不知道您的这个elmoformanylangs是哪个版本的呢

@Ai-Sherry
Copy link
Author

按照你的环境要求安装的,0.0.3版本

@h-guo18
Copy link

h-guo18 commented Jan 6, 2022

您好 问题解决了吗?我遇到了同样的问题

@h-guo18
Copy link

h-guo18 commented Jan 6, 2022

我在哈工大的issue里找到了这个问题:

HIT-SCIR/ELMoForManyLangs#100

是overrides的版本问题,按照里面的提示已解决。

@h-guo18
Copy link

h-guo18 commented Jan 6, 2022

建议把overrides3.1.0加入环境需求

@jesuswa
Copy link

jesuswa commented Dec 13, 2023

建议把overrides3.1.0加入环境需求
牛啊,伟大的神

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

No branches or pull requests

4 participants