【软件安装】pytorch 出现 ‘torch.nn‘ has no attribute ‘MultiheadAttention‘ 错误解决方法
在使用新版本pytorch 执行老版本代码时,或使用 torchkeras 时,有事会出现如下错误:AttributeError: module 'torch.nn' has no attribute 'MultiheadAttention'解决方案:这是由于版本不匹配导致的,一个快速的解决方法是安装另一个包:pip install torch_multi_head_attentionfrom t
·
在使用新版本pytorch 执行老版本代码时,或使用 torchkeras 时,有事会出现如下错误:AttributeError: module 'torch.nn' has no attribute 'MultiheadAttention'
解决方案:
这是由于版本不匹配导致的,一个快速的解决方法是安装另一个包:
pip install torch_multi_head_attentionfrom torch_multi_head_attention import MultiHeadAttention- 使用
MultiHeadAttention代替torch.nn.MultiheadAttention
更多推荐


所有评论(0)