You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Asparagus is a modular machine learning framework designed for medical imaging applications. The codebase is built on PyTorch, Lightning and Hydra and handles model training, experiment management, and evaluation with prepared data. To prepare your data see [Preprocessing](#1-preprocessing). The functional and modules directories follow the structure of torch.nn.functional and torch.nn with the former being stateless functions and the latter being classes that combine and build upon these with the logic and conventions adopted by Asparagus from PyTorch, Lightning, and Hydra.
6
+
3
7
# Table of Contents
4
8
-[Resources](#resources)
5
9
-[Getting Started](#getting-started)
6
10
-[0. Setup](#0-setup)
7
11
-[1. Preprocessing](#1-preprocessing)
8
-
-[2. Data Splitting](#2-trainvaltest-splitting)
9
-
-[3. Training](#3-training)
10
-
-[4. Testing](#4-testing)
12
+
-[2. Training](#3-training)
13
+
-[3. Testing](#4-testing)
14
+
-[Contributing](#contributing)
11
15
12
16
# Resources
13
17
-[Common Issues](./docs/common_issues.md)
@@ -22,87 +26,64 @@
22
26
23
27
## 0. Setup
24
28
25
-
### Regular installation
26
-
To install the package see: [Installation](./docs/installation.md)
27
-
To set up required and optional environment variables see: [Environment Variables](./docs/environment_variables.md)
To install Asparagus on Gefion, please refer to [Installing Asparagus environment on Gefion](./docs/environment_on_gefion.md).
31
37
38
+
### Environment variables
39
+
To set up required and optional environment variables see: [Environment Variables](./docs/environment_variables.md)
32
40
33
41
## 1. Preprocessing
34
-
35
42
See the [asparagus_preprocessing](https://github.com/Sllambias/asparagus_preprocessing) repository.
36
43
37
44
## 2. Training
38
-
Asparagus uses hydra configs (see [Hydra](https://hydra.cc/docs/intro/)) to set up all training runs. To use the default setup 3 args are required.
45
+
Asparagus uses hydra configs (see [Hydra](https://hydra.cc/docs/intro/)) to configure training runs. To use the default setup 3 args are required.
39
46
- The Task to train on
40
47
- The model architecture to use
41
48
- The data split to use
42
49
43
-
These can be given either by creating a config that specifies them see [Example Config 1](./docs/configs.md#example-config-1), or at runtime using the command line as illustrated below.
44
-
45
-
46
-
### 3.1 Run ids
50
+
These can be given either by creating a config that specifies them see [Example Config 1](./docs/configs.md#example-config-1-the-complete-config), or at runtime using the command line as illustrated below.
47
51
48
-
When starting a new training run, Asparagus will assign the run a ´run_id´ which can be used to
52
+
When starting a new training run, Asparagus will assign the run a unique ´run_id´ which can be used to:
49
53
1. restart a failed run
50
54
2. start a training from a pretrained model (however a checkpoint can also be loaded from a path)
Simply add `run_id=123` where `123` is your run id to the command used to start the job. For instance to restart the segmentation job with the pre-defined config from above, just do
To restart a job find the ```run_id``` of the job you want to restart. It will be present in the path and in the hydra output files. Then, rerun the job with the exact same command and configs and add `run_id=123` (where `123` is your run id). Asparagus will detect the existing model folder and load the most recent weights to continue from these.
80
73
81
-
There are two ways of loading
74
+
### 2.3 Finetuning
82
75
83
-
Asparagus will create a "derived_models.log" in the folder of the pretrained model so you can always track which finetuned models and run_id's are its _children_.
76
+
Finetuning largely follows the same structure as training except
84
77
85
-
- Finetuning a segmentation model using the default finetuning config
78
+
- Finetuning a classification/regression/segmentation model using the default finetuning config from a checkpoint with a run_id
86
79
87
-
from a checkpoint with a run_id (typically trained on the same machine)
- Finetuning a regression model is currently not implemented.
104
-
105
-
## 4. Running a segmentation model on the test set
86
+
## 3. Testing
106
87
107
88
## Testing with hydra config
108
89
@@ -117,4 +98,11 @@ checkpoint_run_id: 532
117
98
load_checkpoint_name: epoch=4-step=25.ckpt
118
99
```
119
100
120
-
101
+
# Contributing
102
+
Contributing to the main branch of asparagus follows regular pull request standards.
103
+
- Open pull request.
104
+
- Pass linting, formatting and testing checks. Asparagus repositories use [ruff](https://docs.astral.sh/ruff/) for formatting and linting. To lint locally intall ruff and run ```ruff check --fix``` in the Asparagus directory (omitting --fix for a dry run) and to format locally run ```ruff format``` in the Asparagus directory. Running tests locally can be achieved with pytest. After checks
105
+
- Request review from relevant moderators. If you're in doubt ask the repository owner.
0 commit comments