-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
I ran into the following problem when using convert_trtpose.py to convert densenet121_baseline_att_256x256_B_epoch_160.pth into densenet121_baseline_att_256x256_B_epoch_160.trt, which appears to be due to a mismatch between the model weight and the model definition. Does anyone know how to fix it?
(dev) root@autodl-container-08b111a452-29fa5ced:~/autodl-tmp/human-action-recognition/export_models# python convert_trtpose.py --config ../configs/infer_trtpose_deepsort_dnn.yaml
[INFO] Loading pytorch trtpose model with "../weights/pose_estimation/trtpose/densenet121_baseline_att_256x256_B_epoch_160.pth"
/root/miniconda3/envs/dev/lib/python3.8/site-packages/torchvision/models/_utils.py:208: UserWarning: The parameter 'pretrained' is deprecated since 0.13 and may be removed in the future, please use 'weights' instead.
warnings.warn(
/root/miniconda3/envs/dev/lib/python3.8/site-packages/torchvision/models/_utils.py:223: UserWarning: Arguments other than a weight enum or `None` for 'weights' are deprecated since 0.13 and may be removed in the future. The current behavior is equivalent to passing `weights=DenseNet121_Weights.IMAGENET1K_V1`. You can also use `weights=DenseNet121_Weights.DEFAULT` to get the most up-to-date weights.
warnings.warn(msg)
[INFO] Converting to tensorrt with input shape: (1, 3, 256, 256)
[07/22/2024-15:04:09] [TRT] [E] 3: 1.cmap_up.0:0:DECONVOLUTION:GPU:kernel weights has count 4194304 but 16777216 was expected
[07/22/2024-15:04:09] [TRT] [E] 4: 1.cmap_up.0:0:DECONVOLUTION:GPU: count of 4194304 weights in kernel, but kernel dimensions (4,4) with 1024 input channels, 1024 output channels and 1 groups were specified. Expected Weights count is 1024 * 4*4 * 1024 / 1 = 16777216
[07/22/2024-15:04:09] [TRT] [E] 4: [graphShapeAnalyzer.cpp::needTypeAndDimensions::2212] Error Code 4: Internal Error (1.cmap_up.0:0:DECONVOLUTION:GPU: output shape can not be computed)
[07/22/2024-15:04:09] [TRT] [E] 3: [network.cpp::addScaleNd::1162] Error Code 3: API Usage Error (Parameter check failed at: optimizer/api/network.cpp::addScaleNd::1162, condition: qdqScale || basicScale
)
Traceback (most recent call last):
File "convert_trtpose.py", line 66, in <module>
Fire(main)
File "/root/miniconda3/envs/dev/lib/python3.8/site-packages/fire/core.py", line 143, in Fire
component_trace = _Fire(component, args, parsed_flag_args, context, name)
File "/root/miniconda3/envs/dev/lib/python3.8/site-packages/fire/core.py", line 477, in _Fire
component, remaining_args = _CallAndUpdateTrace(
File "/root/miniconda3/envs/dev/lib/python3.8/site-packages/fire/core.py", line 693, in _CallAndUpdateTrace
component = fn(*varargs, **kwargs)
File "convert_trtpose.py", line 63, in main
export_trt(save_name)
File "convert_trtpose.py", line 34, in __call__
model_trt = torch2trt.torch2trt(
File "/root/miniconda3/envs/dev/lib/python3.8/site-packages/torch2trt-0.5.0-py3.8-linux-x86_64.egg/torch2trt/torch2trt.py", line 643, in torch2trt
outputs = module(*inputs)
File "/root/miniconda3/envs/dev/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1538, in _call_impl
result = forward_call(*args, **kwargs)
File "/root/miniconda3/envs/dev/lib/python3.8/site-packages/torch/nn/modules/container.py", line 217, in forward
input = module(input)
File "/root/miniconda3/envs/dev/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1538, in _call_impl
result = forward_call(*args, **kwargs)
File "/root/miniconda3/envs/dev/lib/python3.8/site-packages/trt_pose-0.0.1-py3.8-linux-x86_64.egg/trt_pose/models/common.py", line 70, in forward
xc = self.cmap_up(x)
File "/root/miniconda3/envs/dev/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1538, in _call_impl
result = forward_call(*args, **kwargs)
File "/root/miniconda3/envs/dev/lib/python3.8/site-packages/torch/nn/modules/container.py", line 217, in forward
input = module(input)
File "/root/miniconda3/envs/dev/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1538, in _call_impl
result = forward_call(*args, **kwargs)
File "/root/miniconda3/envs/dev/lib/python3.8/site-packages/torch/nn/modules/batchnorm.py", line 171, in forward
return F.batch_norm(
File "/root/miniconda3/envs/dev/lib/python3.8/site-packages/torch2trt-0.5.0-py3.8-linux-x86_64.egg/torch2trt/torch2trt.py", line 262, in wrapper
converter["converter"](ctx)
File "/root/miniconda3/envs/dev/lib/python3.8/site-packages/torch2trt-0.5.0-py3.8-linux-x86_64.egg/torch2trt/converters/native_converters.py", line 183, in convert_batch_norm
output._trt = layer.get_output(0)
AttributeError: 'NoneType' object has no attribute 'get_output'
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels