monai
medical
katielink commited on
Commit
99d4084
·
1 Parent(s): 8945a3b

add the command of executing inference with TensorRT models

Browse files
README.md CHANGED
@@ -112,6 +112,12 @@ python -m monai.bundle run --config_file configs/inference.json
112
  python -m monai.bundle trt_export --net_id network_def --filepath models/model_trt.ts --ckpt_file models/model.pt --meta_file configs/metadata.json --config_file configs/inference.json --precision <fp32/fp16> --dynamic_batchsize "[1, 4, 8]"
113
  ```
114
 
 
 
 
 
 
 
115
  # References
116
  [1] Xia, Yingda, et al. "3D Semi-Supervised Learning with Uncertainty-Aware Multi-View Co-Training." arXiv preprint arXiv:1811.12506 (2018). https://arxiv.org/abs/1811.12506.
117
 
 
112
  python -m monai.bundle trt_export --net_id network_def --filepath models/model_trt.ts --ckpt_file models/model.pt --meta_file configs/metadata.json --config_file configs/inference.json --precision <fp32/fp16> --dynamic_batchsize "[1, 4, 8]"
113
  ```
114
 
115
+ #### Execute inference with the TensorRT model
116
+
117
+ ```
118
+ python -m monai.bundle run --config_file "['configs/inference.json', 'configs/inference_trt.json']"
119
+ ```
120
+
121
  # References
122
  [1] Xia, Yingda, et al. "3D Semi-Supervised Learning with Uncertainty-Aware Multi-View Co-Training." arXiv preprint arXiv:1811.12506 (2018). https://arxiv.org/abs/1811.12506.
123
 
configs/inference_trt.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "imports": [
3
+ "$import glob",
4
+ "$import os",
5
+ "$import torch_tensorrt"
6
+ ],
7
+ "handlers#0#_disabled_": true,
8
+ "network_def": "$torch.jit.load(@bundle_root + '/models/model_trt.ts')",
9
+ "evaluator#amp": false
10
+ }
configs/metadata.json CHANGED
@@ -1,7 +1,8 @@
1
  {
2
  "schema": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_20220324.json",
3
- "version": "0.4.3",
4
  "changelog": {
 
5
  "0.4.3": "fix figure and weights inconsistent error",
6
  "0.4.2": "use torch 1.13.1",
7
  "0.4.1": "update the readme file with TensorRT convert",
 
1
  {
2
  "schema": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_20220324.json",
3
+ "version": "0.4.4",
4
  "changelog": {
5
+ "0.4.4": "add the command of executing inference with TensorRT models",
6
  "0.4.3": "fix figure and weights inconsistent error",
7
  "0.4.2": "use torch 1.13.1",
8
  "0.4.1": "update the readme file with TensorRT convert",
docs/README.md CHANGED
@@ -105,6 +105,12 @@ python -m monai.bundle run --config_file configs/inference.json
105
  python -m monai.bundle trt_export --net_id network_def --filepath models/model_trt.ts --ckpt_file models/model.pt --meta_file configs/metadata.json --config_file configs/inference.json --precision <fp32/fp16> --dynamic_batchsize "[1, 4, 8]"
106
  ```
107
 
 
 
 
 
 
 
108
  # References
109
  [1] Xia, Yingda, et al. "3D Semi-Supervised Learning with Uncertainty-Aware Multi-View Co-Training." arXiv preprint arXiv:1811.12506 (2018). https://arxiv.org/abs/1811.12506.
110
 
 
105
  python -m monai.bundle trt_export --net_id network_def --filepath models/model_trt.ts --ckpt_file models/model.pt --meta_file configs/metadata.json --config_file configs/inference.json --precision <fp32/fp16> --dynamic_batchsize "[1, 4, 8]"
106
  ```
107
 
108
+ #### Execute inference with the TensorRT model
109
+
110
+ ```
111
+ python -m monai.bundle run --config_file "['configs/inference.json', 'configs/inference_trt.json']"
112
+ ```
113
+
114
  # References
115
  [1] Xia, Yingda, et al. "3D Semi-Supervised Learning with Uncertainty-Aware Multi-View Co-Training." arXiv preprint arXiv:1811.12506 (2018). https://arxiv.org/abs/1811.12506.
116