`Highway.forward: ELMo 嵌入中必须存在输入?
`Highway.forward: input must be present` in ELMo embedding?
我用Elmo Embeddings for my NLP task. The pretrain was in the Indonesian language from this git。使用语法
导入库
from elmoformanylangs import Embedder
导致以下错误:
TypeError: Highway.forward: input must be present
请帮助我理解错误消息的含义。
不确定这是否有帮助,但这指的是 torch.nn.Module
中未实现的 superclass 方法(forward)。此 class 具有以下定义。
forward: Callable[..., Any] = _forward_unimplemented
如果向下滚动一点,您会看到 _forward_unimplemented 的定义:
def _forward_unimplemented(self, *input: Any) -> None:
Highway 前向定义也必须匹配此签名,因此您也需要一个 *input
参数。
我的匈牙利语版本使用以下签名和第一行,可能这对你也有帮助。
def forward(self, *input: torch.Tensor) -> type(None): #pylint: disable=arguments-differ
current_input = input[0]
我刚刚在我的 python 环境的站点包下编辑了我的 \elmoformanylangs\modules\highway.py 文件,并使其正常工作。
只需这样做:
pip uninstall overrides
pip install overrides==3.1.0
我的问题是由于 overrides
.
的版本不受支持
如果您使用的是 anaconda,您始终可以通过 conda install overrides==no.version
安装合适的版本。
我用Elmo Embeddings for my NLP task. The pretrain was in the Indonesian language from this git。使用语法
导入库from elmoformanylangs import Embedder
导致以下错误:
TypeError: Highway.forward: input must be present
请帮助我理解错误消息的含义。
不确定这是否有帮助,但这指的是 torch.nn.Module
中未实现的 superclass 方法(forward)。此 class 具有以下定义。
forward: Callable[..., Any] = _forward_unimplemented
如果向下滚动一点,您会看到 _forward_unimplemented 的定义:
def _forward_unimplemented(self, *input: Any) -> None:
Highway 前向定义也必须匹配此签名,因此您也需要一个 *input
参数。
我的匈牙利语版本使用以下签名和第一行,可能这对你也有帮助。
def forward(self, *input: torch.Tensor) -> type(None): #pylint: disable=arguments-differ
current_input = input[0]
我刚刚在我的 python 环境的站点包下编辑了我的 \elmoformanylangs\modules\highway.py 文件,并使其正常工作。
只需这样做:
pip uninstall overrides
pip install overrides==3.1.0
我的问题是由于 overrides
.
如果您使用的是 anaconda,您始终可以通过 conda install overrides==no.version
安装合适的版本。