Skip to content

Commit

Permalink
Add notebook for pythonic bundle access (#1501)
Browse files Browse the repository at this point in the history
Fixes #1502 .

### Description
In this PR, we'll explore how to access a bundle in Python and use it in
your own application which cover the following topics:
1. Downloading the Bundle
2. Creating a `BundleWorkflow`
3. Getting Properties from the Bundle
4. Using Pretrained Weights from the Bundle
5. Updating Properties
6. Using Components in Your Own Pipeline

### Checks
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Avoid including large-size files in the PR.
- [x] Clean up long text outputs from code cells in the notebook.
- [x] For security purposes, please check the contents and remove any
sensitive info such as user names and private key.
- [x] Ensure (1) hyperlinks and markdown anchors are working (2) use
relative paths for tutorial repo files (3) put figure and graphs in the
`./figure` folder
- [x] Notebook runs automatically `./runner.sh -t <path to .ipynb file>`

---------

Signed-off-by: KumoLiu <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
KumoLiu and pre-commit-ci[bot] authored Sep 6, 2023
1 parent 8a5c8a6 commit 799f40b
Show file tree
Hide file tree
Showing 2 changed files with 608 additions and 0 deletions.
39 changes: 39 additions & 0 deletions bundle/pythonic_usage_guidance/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Pythonic Bundle Access Tutorial

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:
1. Downloading the Bundle.
2. Creating a `BundleWorkflow`.
3. Getting Properties from the Bundle.
4. Updating Properties.
5. Using Components in Your Own Pipeline.
6. Utilizing Pretrained Weights from the Bundle.
7. A Simple Comparison of the Usage between `ConfigParser` and `BundleWorkflow`.

The example training dataset is Task09_Spleen.tar from http://medicaldecathlon.com/.

## Requirements

The script is tested with:

- `Ubuntu 20.04` | `Python 3.8.10` | `CUDA 12.2` | `Pytorch 1.13.1`

- it is tested on 24gb single-gpu machine

## Dependencies and installation

### MONAI

You can conda environments to install the dependencies.

or you can just use MONAI docker.
```bash
docker pull projectmonai/monai:latest
```

For more information please check out [the installation guide](https://docs.monai.io/en/latest/installation.html).

## Questions and bugs

- 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.
- For bugs relating to MONAI functionality, please create an issue on the [main repository](https://github.com/Project-MONAI/MONAI/issues).
- For bugs relating to the running of a tutorial, please create an issue in [this repository](https://github.com/Project-MONAI/Tutorials/issues).
Loading

0 comments on commit 799f40b

Please sign in to comment.