Skip to content

Commit 1dccf63

Browse files
update doc
Signed-off-by: Yiheng Wang <[email protected]>
1 parent d1e27a3 commit 1dccf63

File tree

1 file changed

+28
-17
lines changed

1 file changed

+28
-17
lines changed

acceleration/fast_inference_tutorial/fast_inference_tutorial.ipynb

+28-17
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@
203203
"loader = LoadImaged(keys=\"image\", reader=\"NibabelReader\", to_gpu=True)\n",
204204
"```\n",
205205
"\n",
206-
"Please note that only NIfTI (.nii, for compressed \".nii.gz\" files, this feature also supports but the acceleration is not significant) and DICOM (.dcm) files are supported for direct GPU data loading.\n"
206+
"Please note that only NIfTI (`.nii`, for compressed `.nii.gz` files, this feature also supports but the acceleration is not guaranteed) and DICOM (`.dcm`) files are supported for direct GPU data loading.\n"
207207
]
208208
},
209209
{
@@ -265,27 +265,15 @@
265265
},
266266
{
267267
"cell_type": "code",
268-
"execution_count": 4,
268+
"execution_count": null,
269269
"metadata": {},
270-
"outputs": [
271-
{
272-
"name": "stdout",
273-
"output_type": "stream",
274-
"text": [
275-
"Test data already exists at ./Task03_Liver/imagesTs_nii\n",
276-
"Weights already exists at ./model.pt\n",
277-
"TensorRT model already exists at ./model_trt.ts\n"
278-
]
279-
}
280-
],
270+
"outputs": [],
281271
"source": [
282272
"root_dir = \".\"\n",
283273
"torch.backends.cudnn.benchmark = True\n",
284274
"torch_tensorrt.runtime.set_multi_device_safe_mode(True)\n",
285275
"device = torch.device(\"cuda:0\") if torch.cuda.is_available() else torch.device(\"cpu\")\n",
286276
"train_files = prepare_test_datalist(root_dir)\n",
287-
"# since the dataset is too large, the smallest 31 files are used for warm up (1 file) and benchmarking (30 files)\n",
288-
"train_files = sorted(train_files, key=lambda x: os.path.getsize(x), reverse=False)[:31]\n",
289277
"weights_path = prepare_model_weights(root_dir=root_dir, bundle_name=\"wholeBody_ct_segmentation\")\n",
290278
"trt_model_name = \"model_trt.ts\"\n",
291279
"trt_model_path = prepare_tensorrt_model(root_dir, weights_path, trt_model_name)"
@@ -609,13 +597,36 @@
609597
"plt.legend()\n",
610598
"plt.show()"
611599
]
600+
},
601+
{
602+
"cell_type": "markdown",
603+
"metadata": {},
604+
"source": [
605+
"## Limitations\n",
606+
"\n",
607+
"Although the optimizations have shown significant improvements in inference time, there are still some limitations to consider:\n",
608+
"\n",
609+
"1. **TensorRT**: \n",
610+
" - **Model Compatibility**: Not all models are compatible with TensorRT. Models with unsupported layers or operations may not benefit from TensorRT acceleration.\n",
611+
" - **Batch Size**: TensorRT is optimized for larger batch sizes. For very small batch sizes, the overhead of conversion and execution might outweigh the performance gains.\n",
612+
" - **Precision**: While using lower precision (e.g., FP16) can speed up inference, it may lead to a loss in model accuracy, which is critical in medical imaging applications.\n",
613+
"\n",
614+
"2. **GPU-Based Preprocessing**:\n",
615+
" - **Memory Usage**: The GPU-based preprocessing requires additional GPU memory. This can be a limitation if the available GPU memory is limited.\n",
616+
"\n",
617+
"3. **GPU Direct Storage (GDS)**:\n",
618+
" - **File Format Support**: Currently, only specific file formats like NIfTI (for compressed `.nii.gz` NIFTI files, this feature also supports but the acceleration is not guaranteed) and DICOM are supported for direct GPU data loading. Other formats may not benefit from this feature.\n",
619+
" - **Small File Acceleration**: For small files, the overhead of conversion and execution might outweigh the performance gains.\n",
620+
"\n",
621+
"By understanding these limitations, users can better assess when and how to apply these acceleration features effectively in their workflows."
622+
]
612623
}
613624
],
614625
"metadata": {
615626
"kernelspec": {
616-
"display_name": "kvikio_env",
627+
"display_name": "monai_tutorial",
617628
"language": "python",
618-
"name": "kvikio_env"
629+
"name": "python3"
619630
},
620631
"language_info": {
621632
"codemirror_mode": {

0 commit comments

Comments
 (0)