-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
meet deploy problem when using Group Fisher in rtmdet with custom data #494
Comments
Fine, change the divisor to 1 can solve this problem but leads to another problem,
|
I'm sorry, I cannot reproduce this problem. I can deploy the pruned rtmdet on onnxcpu sucessfullly. Here is the version of my codes. mmcls 1.0.0rc5 Please try the following commands and provide the error info if it failed razor_config={your config}.py
deploy_config=mmdeploy/configs/mmdet/detection/detection_onnxruntime_static.py
python mmdeploy/tools/deploy.py $deploy_config \
$razor_config \
{your checkpoint} \
mmdeploy/tests/data/tiger.jpeg \
--work-dir ./work_dirs/mmdeploy |
this is my env
here is my command python tools/deploy.py configs/mmdet/detection/detection_onnxruntime_static.py \
../mmrazor/configs/pruning/mmdet/group_fisher/custom/group_fisher_act_deploy_rtmdet_1x_coco.py \
../mmrazor/work_dirs/group_fisher_act_finetune_rtmdet_1x_coco_0.8/best_coco/bbox_mAP_epoch_286.pth \
tests/auto_08856.jpg \
--device cuda:0 \
--work-dir work_dirs/deploy_rtmdet_prune_onnx/\
--dump-info here is the error info
but if I try to use
before the export function in pytorch2onnx.py to export |
We find there is a bug when deploy a pruned model using cuda and fix it in this pr. Please try it. |
We closed the issue as there has been no response in a long time. You can reopen it when you need. |
sry for my no reply, but this pr still can not work in my env.The error info is still the same as before |
Checklist
Describe the question you meet
I use Group Fisher to prune the rtmdet, and when deploying the pruned model with this scripts, it meets the ERROR:Exception: Forward failed, there may be an error in demo input.here I just want to export the onnx or trt model.
Post related information
pip list | grep "mmcv\|mmrazor\|^torch"
mmcv 2.0.0rc4
mmrazor 1.0.0rc2 /home/yaojiahao/zbc/mmrazor
torch 1.13.0+cu116
torchaudio 0.13.0+cu116
torchvision 0.14.0+cu116
/home/yaojiahao/miniconda3/envs/mmyolo/lib/python3.9/site-packages/mmdet/utils/setup_env.py:83: UserWarning: The current default scope "mmyolo" is not "mmdet",
register_all_modules
will force the currentdefault scope to be "mmdet". If this is not expected, please setinit_default_scope=False
.warnings.warn('The current default scope '
/home/yaojiahao/zbc/mmrazor/mmrazor/utils/setup_env.py:77: UserWarning: The current default scope "mmdet" is not "mmrazor",
register_all_modules
will force the currentdefault scope to be "mmrazor". If this is not expected, please setinit_default_scope=False
.warnings.warn(
/home/yaojiahao/miniconda3/envs/mmyolo/lib/python3.9/site-packages/mmdet/utils/setup_env.py:83: UserWarning: The current default scope "mmrazor" is not "mmdet",
register_all_modules
will force the currentdefault scope to be "mmdet". If this is not expected, please setinit_default_scope=False
.warnings.warn('The current default scope '
/home/yaojiahao/miniconda3/envs/mmyolo/lib/python3.9/site-packages/mmdet/utils/setup_env.py:83: UserWarning: The current default scope "mmyolo" is not "mmdet",
register_all_modules
will force the currentdefault scope to be "mmdet". If this is not expected, please setinit_default_scope=False
.warnings.warn('The current default scope '
/home/yaojiahao/miniconda3/envs/mmyolo/lib/python3.9/site-packages/torch/fx/_symbolic_trace.py:564: UserWarning: Was not able to add assertion to guarantee correct input data_samples to specialized function. It is up to the user to make sure that your inputs match the inputs you specialized the function with.
warnings.warn(
/home/yaojiahao/miniconda3/envs/mmyolo/lib/python3.9/site-packages/torch/functional.py:504: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:3190.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
Process Process-2:
Traceback (most recent call last):
File "/home/yaojiahao/miniconda3/envs/mmyolo/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
self.run()
File "/home/yaojiahao/miniconda3/envs/mmyolo/lib/python3.9/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/home/yaojiahao/zbc/mmdeploy/mmdeploy/apis/core/pipeline_manager.py", line 107, in call
ret = func(*args, **kwargs)
File "/home/yaojiahao/zbc/mmdeploy/mmdeploy/apis/pytorch2onnx.py", line 63, in torch2onnx
torch_model = task_processor.build_pytorch_model(model_checkpoint)
File "/home/yaojiahao/zbc/mmdeploy/mmdeploy/codebase/mmrazor/deploy/mmrazor.py", line 133, in build_pytorch_model
model.post_process_for_mmdeploy()
File "/home/yaojiahao/zbc/mmrazor/mmrazor/implementations/pruning/group_fisher/prune_deploy_sub_model.py", line 19, in post_process_for_mmdeploy
s = make_channel_divisible(model, divisor=divisor)
File "/home/yaojiahao/zbc/mmrazor/mmrazor/models/utils/expandable_utils/tools.py", line 76, in make_channel_divisible
mutator = to_expandable_model(model)
File "/home/yaojiahao/zbc/mmrazor/mmrazor/models/utils/expandable_utils/tools.py", line 23, in to_expandable_model
mutator.prepare_from_supernet(model)
File "/home/yaojiahao/zbc/mmrazor/mmrazor/models/mutators/channel_mutator/channel_mutator.py", line 110, in prepare_from_supernet
units = self._prepare_from_tracer(supernet, self.parse_cfg)
File "/home/yaojiahao/zbc/mmrazor/mmrazor/models/mutators/channel_mutator/channel_mutator.py", line 307, in _prepare_from_tracer
unit_configs = tracer.analyze(model)
File "/home/yaojiahao/zbc/mmrazor/mmrazor/models/task_modules/tracer/channel_analyzer.py", line 127, in analyze
return self._find_mutable_units(model, unit_configs)
File "/home/yaojiahao/zbc/mmrazor/mmrazor/models/task_modules/tracer/channel_analyzer.py", line 167, in _find_mutable_units
raise Exception(
Exception: Forward failed, there may be an error in demo input.
5. Other code you modified in the
mmrazor
folder.change the group_fisher_act_{action}_{model}_coco.py
The text was updated successfully, but these errors were encountered: