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

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

Open
yao-th opened this issue Sep 18, 2024 · 2 comments
Open

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

yao-th opened this issue Sep 18, 2024 · 2 comments

Comments

@yao-th
Copy link

yao-th commented Sep 18, 2024

我用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'

@yao-th yao-th changed the title Awesome backbones 训练的模型如何在移动端使用? Awesome backbones 训练的模型如何部署到移动端? Sep 18, 2024
@Fafa-DL
Copy link
Owner

Fafa-DL commented Sep 18, 2024

这里应该不能调用forward_train

@PurpleSky-NS
Copy link

给模型传参数的时候,多传两个False就会走forward_test了,参考导出onnx
#68

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

3 participants