|
42 | 42 | "cell_type": "markdown", |
43 | 43 | "metadata": {}, |
44 | 44 | "source": [ |
45 | | - "## Install environment" |
46 | | - ] |
47 | | - }, |
48 | | - { |
49 | | - "cell_type": "markdown", |
50 | | - "metadata": {}, |
51 | | - "source": [ |
| 45 | + "## Setup environment\n", |
| 46 | + "\n", |
52 | 47 | "Loading data directly from disk to GPU memory requires the `kvikio` library. In addition, this tutorial requires many other dependencies such as `monai`, `torch`, `torch_tensorrt`, `numpy`, `ignite`, `pandas`, `matplotlib`, etc. We recommend using the [MONAI Docker](https://docs.monai.io/en/latest/installation.html#from-dockerhub) image to run this tutorial, which includes pre-configured dependencies and allows you to skip manual installation.\n", |
53 | 48 | "\n", |
54 | 49 | "If not using MONAI Docker, install `kvikio` using one of these methods:\n", |
|
113 | 108 | "from monai.inferers import sliding_window_inference\n", |
114 | 109 | "from monai.networks.nets import SegResNet\n", |
115 | 110 | "import matplotlib.pyplot as plt\n", |
116 | | - "import torch\n", |
117 | 111 | "import gc\n", |
118 | 112 | "import pandas as pd\n", |
119 | 113 | "from timeit import default_timer as timer\n", |
| 114 | + "from utils import prepare_test_datalist, prepare_model_weights, prepare_tensorrt_model\n", |
120 | 115 | "\n", |
121 | 116 | "print_config()" |
122 | 117 | ] |
|
284 | 279 | } |
285 | 280 | ], |
286 | 281 | "source": [ |
287 | | - "from utils import prepare_test_datalist, prepare_model_weights, prepare_tensorrt_model\n", |
288 | | - "\n", |
289 | 282 | "root_dir = \".\"\n", |
290 | 283 | "torch.backends.cudnn.benchmark = True\n", |
291 | 284 | "torch_tensorrt.runtime.set_multi_device_safe_mode(True)\n", |
|
465 | 458 | "outputs": [], |
466 | 459 | "source": [ |
467 | 460 | "# collect benchmark results\n", |
468 | | - "all_df = pd.read_csv(os.path.join(root_dir, f\"time_original.csv\"))\n", |
| 461 | + "all_df = pd.read_csv(os.path.join(root_dir, \"time_original.csv\"))\n", |
469 | 462 | "all_df.columns = [\"file_name\", \"original_time\"]\n", |
470 | 463 | "\n", |
471 | 464 | "for benchmark_type in [\"trt\", \"trt_gpu_transforms\", \"trt_gds_gpu_transforms\"]:\n", |
|
0 commit comments