Skip to content

Commit 0bdb79b

Browse files
committed
add readme
Signed-off-by: KumoLiu <[email protected]>
1 parent 095597b commit 0bdb79b

File tree

2 files changed

+42
-3
lines changed

2 files changed

+42
-3
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Pythonic Bundle Access Tutorial
2+
3+
A MONAI bundle contains the stored weights of a model, training, inference, post-processing transform sequences and other information. This tutorial aims to explore how to access a bundle in Python and use it in your own application. We'll cover the following topics:
4+
1. Downloading the Bundle.
5+
2. Creating a `BundleWorkflow`.
6+
3. Getting Properties from the Bundle.
7+
4. Updating Properties.
8+
5. Using Components in Your Own Pipeline.
9+
6. Utilizing Pretrained Weights from the Bundle.
10+
7. A Simple Comparison of the Usage between `ConfigParser` and `BundleWorkflow`.
11+
12+
The example training dataset is Task09_Spleen.tar from http://medicaldecathlon.com/.
13+
14+
## Requirements
15+
16+
The script is tested with:
17+
18+
- `Ubuntu 20.04` | `Python 3.8.10` | `CUDA 12.2` | `Pytorch 1.13.1`
19+
20+
- it is tested on 24gb single-gpu machine
21+
22+
## Dependencies and installation
23+
24+
### MONAI
25+
26+
You can conda environments to install the dependencies.
27+
28+
or you can just use MONAI docker.
29+
```bash
30+
docker pull projectmonai/monai:latest
31+
```
32+
33+
For more information please check out [the installation guide](https://docs.monai.io/en/latest/installation.html).
34+
35+
## Questions and bugs
36+
37+
- For questions relating to the use of MONAI, please use our [Discussions tab](https://github.com/Project-MONAI/MONAI/discussions) on the main repository of MONAI.
38+
- For bugs relating to MONAI functionality, please create an issue on the [main repository](https://github.com/Project-MONAI/MONAI/issues).
39+
- For bugs relating to the running of a tutorial, please create an issue in [this repository](https://github.com/Project-MONAI/Tutorials/issues).

bundle/pythonic_usage_guidance/pythonic_bundle_access.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,15 +336,15 @@
336336
"n_splits = 3\n",
337337
"ensemble_transform = MeanEnsembled(keys=[\"pred\"] * n_splits, output_key=\"pred\")\n",
338338
"update_postprocessing = Compose((ensemble_transform, train_workflow.val_postprocessing))\n",
339-
"\n",
340339
"print(update_postprocessing.transforms)\n",
341340
"\n",
341+
"device = train_workflow.device\n",
342342
"train_workflow.add_property(name=\"dataloader\", required=True, config_id=\"train#dataloader\")\n",
343343
"evaluator = EnsembleEvaluator(\n",
344-
" device=train_workflow.device,\n",
344+
" device=device,\n",
345345
" val_data_loader=train_workflow.dataloader,\n",
346346
" pred_keys=[\"pred\"] * n_splits,\n",
347-
" networks=[train_workflow.network_def] * n_splits,\n",
347+
" networks=[train_workflow.network_def.to(train_workflow.device)] * n_splits,\n",
348348
" inferer=train_workflow.train_inferer,\n",
349349
" postprocessing=update_postprocessing,\n",
350350
")\n",

0 commit comments

Comments
 (0)