katielink commited on
Commit
bd519ec
1 Parent(s): dc87221

add the command of executing inference with TensorRT models

Browse files
README.md CHANGED
@@ -113,6 +113,12 @@ python -m monai.bundle ckpt_export network_def --filepath models/model.ts --ckpt
113
  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>
114
  ```
115
 
 
 
 
 
 
 
116
  # References
117
  [1] Tan, M. and Le, Q. V. Efficientnet: Rethinking model scaling for convolutional neural networks. ICML, 2019a. https://arxiv.org/pdf/1905.11946.pdf
118
 
 
113
  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>
114
  ```
115
 
116
+ #### Execute inference with the TensorRT model
117
+
118
+ ```
119
+ python -m monai.bundle run --config_file "['configs/inference.json', 'configs/inference_trt.json']"
120
+ ```
121
+
122
  # References
123
  [1] Tan, M. and Le, Q. V. Efficientnet: Rethinking model scaling for convolutional neural networks. ICML, 2019a. https://arxiv.org/pdf/1905.11946.pdf
124
 
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.4",
4
  "changelog": {
 
5
  "0.4.4": "adapt to BundleWorkflow interface",
6
  "0.4.3": "update this bundle to support TensorRT convert",
7
  "0.4.2": "support monai 1.2 new FlexibleUNet",
 
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.5",
4
  "changelog": {
5
+ "0.4.5": "add the command of executing inference with TensorRT models",
6
  "0.4.4": "adapt to BundleWorkflow interface",
7
  "0.4.3": "update this bundle to support TensorRT convert",
8
  "0.4.2": "support monai 1.2 new FlexibleUNet",
docs/README.md CHANGED
@@ -106,6 +106,12 @@ python -m monai.bundle ckpt_export network_def --filepath models/model.ts --ckpt
106
  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>
107
  ```
108
 
 
 
 
 
 
 
109
  # References
110
  [1] Tan, M. and Le, Q. V. Efficientnet: Rethinking model scaling for convolutional neural networks. ICML, 2019a. https://arxiv.org/pdf/1905.11946.pdf
111
 
 
106
  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>
107
  ```
108
 
109
+ #### Execute inference with the TensorRT model
110
+
111
+ ```
112
+ python -m monai.bundle run --config_file "['configs/inference.json', 'configs/inference_trt.json']"
113
+ ```
114
+
115
  # References
116
  [1] Tan, M. and Le, Q. V. Efficientnet: Rethinking model scaling for convolutional neural networks. ICML, 2019a. https://arxiv.org/pdf/1905.11946.pdf
117