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

Export to engine fail error #621

Open
dsbyprateekg opened this issue Jan 4, 2025 · 0 comments
Open

Export to engine fail error #621

dsbyprateekg opened this issue Jan 4, 2025 · 0 comments

Comments

@dsbyprateekg
Copy link

Command used:
!python export.py --weight custom-yolov9e.pt --include engine --device 0

Error:
`export: data=data/coco.yaml, weights=['/datasets/yolov9/runs/train/yolov9-custom-9e/weights/custom-yolov9e.pt'], imgsz=[640, 640], batch_size=1, device=0, half=False, inplace=False, keras=False, optimize=False, int8=False, dynamic=False, simplify=False, opset=12, verbose=False, workspace=4, nms=False, agnostic_nms=False, topk_per_class=100, topk_all=100, iou_thres=0.45, conf_thres=0.25, include=['engine']
YOLO 🚀 v0.1-104-g5b1ea9a Python-3.8.10 torch-2.4.1+cu121 CUDA:0 (NVIDIA A10-24Q, 24298MiB)

/datasets/yolov9/models/experimental.py:243: FutureWarning: You are using torch.load with weights_only=False (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for weights_only will be flipped to True. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via torch.serialization.add_safe_globals. We recommend you start setting weights_only=True for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
ckpt = torch.load(attempt_download(w), map_location='cpu') # load
Fusing layers...
gelan-e summary: 690 layers, 57288866 parameters, 3308818 gradients, 188.6 GFLOPs

PyTorch: starting from /datasets/yolov9/runs/train/yolov9-custom-9e/weights/custom-yolov9e.pt with output shape (1, 10, 8400) (111.7 MB)

ONNX: starting export with onnx 1.17.0...
ONNX: export success ✅ 3.3s, saved as /datasets/yolov9/runs/train/yolov9-custom-9e/weights/custom-yolov9e.onnx (218.9 MB)

TensorRT: starting export with TensorRT 8.4.3.1...
[01/04/2025-05:23:35] [TRT] [I] [MemUsageChange] Init CUDA: CPU +564, GPU +0, now: CPU 1156, GPU 4265 (MiB)
[01/04/2025-05:23:36] [TRT] [I] [MemUsageChange] Init builder kernel library: CPU +433, GPU +104, now: CPU 1608, GPU 4369 (MiB)
export.py:287: DeprecationWarning: Use set_memory_pool_limit instead.
config.max_workspace_size = workspace * 1 << 30
[01/04/2025-05:23:36] [TRT] [I] ----------------------------------------------------------------
[01/04/2025-05:23:36] [TRT] [I] Input filename: /datasets/yolov9/runs/train/yolov9-custom-9e/weights/custom-yolov9e.onnx
[01/04/2025-05:23:36] [TRT] [I] ONNX IR version: 0.0.7
[01/04/2025-05:23:36] [TRT] [I] Opset version: 12
[01/04/2025-05:23:36] [TRT] [I] Producer name: pytorch
[01/04/2025-05:23:36] [TRT] [I] Producer version: 2.4.1
[01/04/2025-05:23:36] [TRT] [I] Domain:
[01/04/2025-05:23:36] [TRT] [I] Model version: 0
[01/04/2025-05:23:36] [TRT] [I] Doc string:
[01/04/2025-05:23:36] [TRT] [I] ----------------------------------------------------------------
[01/04/2025-05:23:36] [TRT] [W] onnx2trt_utils.cpp:369: Your ONNX model has been generated with INT64 weights, while TensorRT does not natively support INT64. Attempting to cast down to INT32.
[01/04/2025-05:23:38] [TRT] [E] ModelImporter.cpp:773: While parsing node number 1341 [Conv -> "/model.42/cv2.2/cv2.2.2/Conv_output_0"]:
[01/04/2025-05:23:38] [TRT] [E] ModelImporter.cpp:774: --- Begin node ---
[01/04/2025-05:23:38] [TRT] [E] ModelImporter.cpp:775: input: "/model.42/cv2.2/cv2.2.1/act/Mul_output_0"
input: "model.42.cv2.2.2.weight"
input: "model.42.cv2.2.2.bias"
output: "/model.42/cv2.2/cv2.2.2/Conv_output_0"
name: "/model.42/cv2.2/cv2.2.2/Conv"
op_type: "Conv"
attribute {
name: "dilations"
ints: 1
ints: 1
type: INTS
}
attribute {
name: "group"
i: 4
type: INT
}
attribute {
name: "kernel_shape"
ints: 1
ints: 1
type: INTS
}
attribute {
name: "pads"
ints: 0
ints: 0
ints: 0
ints: 0
type: INTS
}
attribute {
name: "strides"
ints: 1
ints: 1
type: INTS
}
[01/04/2025-05:23:38] [TRT] [E] ModelImporter.cpp:776: --- End node ---
[01/04/2025-05:23:38] [TRT] [E] ModelImporter.cpp:779: ERROR: ModelImporter.cpp:163 In function parseGraph:
[6] Invalid Node - /model.42/cv2.2/cv2.2.2/Conv
The bias tensor is required to be an initializer for the Conv operator. Try applying constant folding on the model using Polygraphy: https://github.com/NVIDIA/TensorRT/tree/master/tools/Polygraphy/examples/cli/surgeon/02_folding_constants
TensorRT: export failure ❌ 5.9s: failed to load ONNX file: /datasets/yolov9/runs/train/yolov9-custom-9e/weights/custom-yolov9e.onnx`

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

1 participant