1. 服务器版本的问题
报错记录error:‘Hardswish‘ object has no attribute ‘inplace‘
本地Pycharm很快就调好了,直接修改,但是服务器的模型内置文件搞了半天
1.分别把 torch 版本降到 1.6.0 、torchvision 版本降到 0.7.0,执行检测,成功~
2.直接改源代码,我用的是这种
改torch的activation.py文件,改完确实有效,记录一下。
根据报错提示的路径,编辑/torch/nn/modules/activation.py,把“,self.inplace”删掉,大概在438行左右。
def forward(self, input: Tensor) -> Tensor:
#return F.hardswish(input, self.inplace) #删除,self,inplace即可
return F.hardswish(input