Fafa-DL / Awesome-Backbones

Integrate deep learning models for image classification | Backbone learning/comparison/magic modification project
1.55k stars 248 forks source link

Awesome backbones 训练的模型如何部署到移动端? #130

Open yao-th opened 1 month ago

yao-th commented 1 month ago

我用torch.jit.trace() export 模型的时候报错, 之前也有人遇到同样的问题. 不知道如何解决? 或者有其他的方法让AB输出的模型在移动端上使用么?

(torch) E:\python\Awesome-Backbones>python tools/pth2pt.py models\repvgg\repvgg_A0.py Loading Train_Epoch042-Loss0.012.pth

Traceback (most recent call last): File "tools/pth2pt.py", line 125, in main() File "tools/pth2pt.py", line 121, in main traced_script_module = torch.jit.trace(model, example) File "D:\anaconda3\envs\torch\lib\site-packages\torch\jit_trace.py", line 742, in trace _module_class, File "D:\anaconda3\envs\torch\lib\site-packages\torch\jit_trace.py", line 940, in trace_module _force_outplace, File "D:\anaconda3\envs\torch\lib\site-packages\torch\nn\modules\module.py", line 725, in _call_impl result = self._slow_forward(*input, *kwargs) File "D:\anaconda3\envs\torch\lib\site-packages\torch\nn\modules\module.py", line 709, in _slow_forward result = self.forward(input, kwargs) File "E:\python\Awesome-Backbones\models\build.py", line 125, in forward return self.forward_train(x,kwargs) TypeError: forward_train() missing 1 required positional argument: 'targets'

Fafa-DL commented 1 month ago

这里应该不能调用forward_train