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

ValueError: Modules that have backward hooks assigned can't be compiled: Conv2d(512, 18, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) #30

Open
Kurocuki opened this issue Jan 16, 2023 · 1 comment

Comments

@Kurocuki
Copy link

up up,想了很久不知道怎么解决,全部的问题如下:
Traceback (most recent call last):
File "D:/Users/wwj/project/tph-yolov5-main/train.py", line 637, in
main(opt)
File "D:/Users/wwj/project/tph-yolov5-main/train.py", line 534, in main
train(opt.hyp, opt, device, callbacks)
File "D:/Users/wwj/project/tph-yolov5-main/train.py", line 355, in train
callbacks.run('on_train_batch_end', ni, model, imgs, targets, paths, plots, opt.sync_bn)
File "D:\Users\wwj\project\tph-yolov5-main\utils\callbacks.py", line 76, in run
logger['callback'](*args, **kwargs)
File "D:\Users\wwj\project\tph-yolov5-main\utils\loggers_init_.py", line 86, in on_train_batch_end
self.tb.add_graph(torch.jit.trace(de_parallel(model), imgs[0:1], strict=False), [])
File "D:\Users\wwj\Anaconda\envs\yolov5\lib\site-packages\torch\jit_trace.py", line 750, in trace
_module_class,
File "D:\Users\wwj\Anaconda\envs\yolov5\lib\site-packages\torch\jit_trace.py", line 942, in trace_module
module = make_module(mod, _module_class, _compilation_unit)
File "D:\Users\wwj\Anaconda\envs\yolov5\lib\site-packages\torch\jit_trace.py", line 568, in make_module
return _module_class(mod, _compilation_unit=_compilation_unit)
File "D:\Users\wwj\Anaconda\envs\yolov5\lib\site-packages\torch\jit_trace.py", line 1068, in init
submodule, TracedModule, _compilation_unit=None
File "D:\Users\wwj\Anaconda\envs\yolov5\lib\site-packages\torch\jit_trace.py", line 568, in make_module
return _module_class(mod, _compilation_unit=_compilation_unit)
File "D:\Users\wwj\Anaconda\envs\yolov5\lib\site-packages\torch\jit_trace.py", line 1068, in init
submodule, TracedModule, _compilation_unit=None
File "D:\Users\wwj\Anaconda\envs\yolov5\lib\site-packages\torch\jit_trace.py", line 568, in make_module
return _module_class(mod, _compilation_unit=_compilation_unit)
File "D:\Users\wwj\Anaconda\envs\yolov5\lib\site-packages\torch\jit_trace.py", line 1068, in init
submodule, TracedModule, _compilation_unit=None
File "D:\Users\wwj\Anaconda\envs\yolov5\lib\site-packages\torch\jit_trace.py", line 568, in make_module
return _module_class(mod, _compilation_unit=_compilation_unit)
File "D:\Users\wwj\Anaconda\envs\yolov5\lib\site-packages\torch\jit_trace.py", line 1061, in init
+ str(orig)

@minhtai048
Copy link

put --no-trace to your parsing code. It works for me! Hope it helps you too

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

2 participants