Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganize architecture #602

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test_cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ jobs:
python-version: ${{ env.PYTHON_VERSION }}
- name: Run CLI tests
run: |
make env.conda
source /builds/miniconda3/etc/profile.d/conda.sh
make env.conda
conda activate "${{ github.workspace }}"/env
make install
cd tests
poetry run pytest --verbose \
poetry run pytest \
--junitxml=./test-reports/test_cli_report.xml \
--disable-warnings \
--verbose \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ jobs:
python-version: ${{ env.PYTHON_VERSION }}
- name: Run tests for generate task
run: |
make env.conda
source /builds/miniconda3/etc/profile.d/conda.sh
make env.conda
conda activate "${{ github.workspace }}"/env
make install
cd tests
poetry run pytest --verbose \
poetry run pytest \
--junitxml=./test-reports/test_generate_report.xml \
--disable-warnings \
--verbose \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_interpret.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ jobs:
python-version: ${{ env.PYTHON_VERSION }}
- name: Run tests for Interpret task on GPU
run: |
make env.conda
source "${HOME}/miniconda3/etc/profile.d/conda.sh"
make env.conda
conda activate "${{ github.workspace }}"/env
make install
cd tests
poetry run pytest --verbose \
poetry run pytest \
--junitxml=./test-reports/test_interpret_report.xml \
--disable-warnings \
--verbose \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_predict.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ jobs:
python-version: ${{ env.PYTHON_VERSION }}
- name: Run tests for predict task
run: |
make env.conda
source /builds/miniconda3/etc/profile.d/conda.sh
make env.conda
conda activate "${{ github.workspace }}"/env
make install
cd tests
poetry run pytest --verbose \
poetry run pytest \
--junitxml=./test-reports/test_predict_report.xml \
--disable-warnings \
--verbose \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_prepare_data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ jobs:
python-version: ${{ env.PYTHON_VERSION }}
- name: Run tests for prepare data task
run: |
make env.conda
source /builds/miniconda3/etc/profile.d/conda.sh
make env.conda
conda activate "${{ github.workspace }}"/env
make install
cd tests
poetry run pytest --verbose \
poetry run pytest \
--junitxml=./test-reports/test_prepare_data_report.xml \
--disable-warnings \
--verbose \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_quality_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ jobs:
python-version: ${{ env.PYTHON_VERSION }}
- name: Run tests for Quality Check
run: |
make env.conda
source /builds/miniconda3/etc/profile.d/conda.sh
make env.conda
conda activate "${{ github.workspace }}"/env
make install
cd tests
poetry run pytest --verbose \
poetry run pytest \
--junitxml=./test-reports/test_quality_check_report.xml \
--disable-warnings \
--verbose \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_random_search.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ jobs:
python-version: ${{ env.PYTHON_VERSION }}
- name: Run Random Search tests on GPU
run: |
make env.conda
source "${HOME}/miniconda3/etc/profile.d/conda.sh"
make env.conda
conda activate "${{ github.workspace }}"/env
make install
cd tests
poetry run pytest --verbose \
poetry run pytest \
--junitxml=./test-reports/test_random_search_report.xml \
--disable-warnings \
--verbose \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_resume.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ jobs:
python-version: ${{ env.PYTHON_VERSION }}
- name: Run resume tests on GPU
run: |
make env.conda
source "${HOME}/miniconda3/etc/profile.d/conda.sh"
make env.conda
conda activate "${{ github.workspace }}"/env
make install
cd tests
poetry run pytest --verbose \
poetry run pytest \
--junitxml=./test-reports/test_resume_report.xml \
--disable-warnings \
--verbose \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_train.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ jobs:
python-version: ${{ env.PYTHON_VERSION }}
- name: Run tests for Train on GPU
run: |
make env.conda
source "${HOME}/miniconda3/etc/profile.d/conda.sh"
make env.conda
conda activate "${{ github.workspace }}"/env
make install
cd tests
poetry run pytest --verbose \
poetry run pytest \
--junitxml=./test-reports/test_train_report.xml \
--disable-warnings \
--verbose \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_transfer_learning.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ jobs:
python-version: ${{ env.PYTHON_VERSION }}
- name: Run tests for Transfer Learning on GPU
run: |
make env.conda
source "${HOME}/miniconda3/etc/profile.d/conda.sh"
make env.conda
conda activate "${{ github.workspace }}"/env
make install
cd tests
poetry run pytest --verbose \
poetry run pytest \
--junitxml=./test-reports/test_transfer_learning_report.xml \
--disable-warnings \
--verbose \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_tsvtools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ jobs:
python-version: ${{ env.PYTHON_VERSION }}
- name: Run tests for TSV tools
run: |
make env.conda
source /builds/miniconda3/etc/profile.d/conda.sh
make env.conda
conda activate "${{ github.workspace }}"/env
make install
cd tests
poetry run pytest --verbose \
poetry run pytest \
--junitxml=./test-reports/test_tsvtools_report.xml \
--disable-warnings \
--verbose \
Expand Down
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,34 +33,33 @@
## About the project

This repository hosts ClinicaDL, the deep learning extension of [Clinica](https://github.com/aramis-lab/clinica),
a python library to process neuroimaging data in [BIDS](https://bids.neuroimaging.io/index.html) format.
a Python library to process neuroimaging data in [BIDS](https://bids.neuroimaging.io/index.html) format.

> **Disclaimer:** this software is **under development**. Some features can
change between different releases and/or commits.

To access the full documentation of the project, follow the link
[https://clinicadl.readthedocs.io/](https://clinicadl.readthedocs.io/).
To access the full documentation of the project, follow the link [https://clinicadl.readthedocs.io/](https://clinicadl.readthedocs.io/).
If you find a problem when using it or if you want to provide us feedback,
please [open an issue](https://github.com/aramis-lab/ad-dl/issues) or write on
the [forum](https://groups.google.com/forum/#!forum/clinica-user).

## Getting started

ClinicaDL currently supports macOS and Linux.

We recommend to use `conda` or `virtualenv` for the installation of ClinicaDL
as it guarantees the correct management of libraries depending on common
packages:
as it guarantees the correct management of libraries depending on common packages:

```{.sourceCode .bash}
conda create --name ClinicaDL python=3.8
conda create --name ClinicaDL python=3.10
conda activate ClinicaDL
pip install clinicadl
```

## Tutorial
Visit our [hands-on tutorial web
site](https://aramislab.paris.inria.fr/clinicadl/tuto) to start
using **ClinicaDL** directly in a Google Colab instance!
## Tutorial

Visit our [hands-on tutorial web site](https://aramislab.paris.inria.fr/clinicadl/tuto)
to start using **ClinicaDL** directly in a Google Colab instance!

## Related Repositories

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@ def on_train_end(self, parameters, **kwargs):
class Tracker(Callback):
def on_train_begin(self, parameters, **kwargs):
if parameters["track_exp"] == "wandb":
from clinicadl.utils.tracking_exp import WandB_handler
from clinicadl.callbacks.tracking_exp import WandB_handler

self.run = WandB_handler(
kwargs["split"], parameters, kwargs["maps_path"].name
)

if parameters["track_exp"] == "mlflow":
from clinicadl.utils.tracking_exp import Mlflow_handler
from clinicadl.callbacks.tracking_exp import Mlflow_handler

self.run = Mlflow_handler(
kwargs["split"], parameters, kwargs["maps_path"].name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
from pydantic import BaseModel, ConfigDict, computed_field, field_validator
from pydantic.types import NonNegativeFloat, NonNegativeInt, PositiveFloat, PositiveInt

from clinicadl.preprocessing.preprocessing import read_preprocessing
from clinicadl.utils.enum import ExperimentTracking
from clinicadl.utils.preprocessing import read_preprocessing

logger = getLogger("clinicadl.callbacks_config")

Expand Down
File renamed without changes.
16 changes: 9 additions & 7 deletions clinicadl/cmdline.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
# coding: utf8
import click

from clinicadl.generate.generate_cli import cli as generate_cli
from clinicadl.hugging_face.hugging_face_cli import cli as hf_cli
from clinicadl.interpret.interpret_cli import cli as interpret_cli
from clinicadl.predict.predict_cli import cli as predict_cli
from clinicadl.prepare_data.prepare_data_cli import cli as prepare_data_cli
from clinicadl.prepare_data.prepare_data_from_bids_cli import (
from clinicadl.commandline.pipelines.generate.cli import cli as generate_cli
from clinicadl.commandline.pipelines.interpret.cli import cli as interpret_cli
from clinicadl.commandline.pipelines.predict.cli import cli as predict_cli
from clinicadl.commandline.pipelines.prepare_data.prepare_data_cli import (
cli as prepare_data_cli,
)
from clinicadl.commandline.pipelines.prepare_data.prepare_data_from_bids_cli import (
cli as prepare_data_from_bids_cli,
)
from clinicadl.commandline.pipelines.train.cli import cli as train_cli
from clinicadl.hugging_face.hugging_face_cli import cli as hf_cli
from clinicadl.quality_check.qc_cli import cli as qc_cli
from clinicadl.random_search.random_search_cli import cli as random_search_cli
from clinicadl.train.train_cli import cli as train_cli
from clinicadl.tsvtools.cli import cli as tsvtools_cli
from clinicadl.utils.logger import setup_logging

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import click

from clinicadl.config.config.callbacks import CallbacksConfig
from clinicadl.utils.config_utils import get_default_from_config_class as get_default
from clinicadl.utils.config_utils import get_type_from_config_class as get_type
from clinicadl.callbacks.config import CallbacksConfig
from clinicadl.config.config_utils import get_default_from_config_class as get_default
from clinicadl.config.config_utils import get_type_from_config_class as get_type

emissions_calculator = click.option(
"--calculate_emissions/--dont_calculate_emissions",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import click

from clinicadl.config.config.computational import ComputationalConfig
from clinicadl.utils.config_utils import get_default_from_config_class as get_default
from clinicadl.utils.config_utils import get_type_from_config_class as get_type
from clinicadl.config.config_utils import get_default_from_config_class as get_default
from clinicadl.config.config_utils import get_type_from_config_class as get_type

# Computational
amp = click.option(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import click

from clinicadl.config.config.cross_validation import CrossValidationConfig
from clinicadl.utils.config_utils import get_default_from_config_class as get_default
from clinicadl.utils.config_utils import get_type_from_config_class as get_type
from clinicadl.config.config_utils import get_default_from_config_class as get_default
from clinicadl.config.config_utils import get_type_from_config_class as get_type

# Cross Validation
n_splits = click.option(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import click

from clinicadl.config.config.data import DataConfig
from clinicadl.utils.config_utils import get_default_from_config_class as get_default
from clinicadl.utils.config_utils import get_type_from_config_class as get_type
from clinicadl.config.config_utils import get_default_from_config_class as get_default
from clinicadl.config.config_utils import get_type_from_config_class as get_type

# Data
baseline = click.option(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import click

from clinicadl.config.config.dataloader import DataLoaderConfig
from clinicadl.utils.config_utils import get_default_from_config_class as get_default
from clinicadl.utils.config_utils import get_type_from_config_class as get_type
from clinicadl.config.config_utils import get_default_from_config_class as get_default
from clinicadl.config.config_utils import get_type_from_config_class as get_type

# DataLoader
batch_size = click.option(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import click

from clinicadl.config.config.early_stopping import EarlyStoppingConfig
from clinicadl.utils.config_utils import get_default_from_config_class as get_default
from clinicadl.utils.config_utils import get_type_from_config_class as get_type
from clinicadl.config.config_utils import get_default_from_config_class as get_default
from clinicadl.config.config_utils import get_type_from_config_class as get_type

# Early Stopping
patience = click.option(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import click

from clinicadl.config.config.maps_manager import MapsManagerConfig
from clinicadl.utils.config_utils import get_type_from_config_class as get_type
from clinicadl.config.config_utils import get_type_from_config_class as get_type

maps_dir = click.argument("maps_dir", type=get_type("maps_dir", MapsManagerConfig))
data_group = click.option("data_group", type=get_type("data_group", MapsManagerConfig))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
DTIModalityConfig,
PETModalityConfig,
)
from clinicadl.utils.config_utils import get_default_from_config_class as get_default
from clinicadl.utils.config_utils import get_type_from_config_class as get_type
from clinicadl.config.config_utils import get_default_from_config_class as get_default
from clinicadl.config.config_utils import get_type_from_config_class as get_type

tracer = click.option(
"--tracer",
Expand Down
20 changes: 20 additions & 0 deletions clinicadl/commandline/modules_options/network.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import click

from clinicadl.config.config_utils import get_default_from_config_class as get_default
from clinicadl.config.config_utils import get_type_from_config_class as get_type
from clinicadl.network.config import NetworkConfig

# Model
multi_network = click.option(
"--multi_network/--single_network",
default=get_default("multi_network", NetworkConfig),
help="If provided uses a multi-network framework.",
show_default=True,
)
dropout = click.option(
"--dropout",
type=get_type("dropout", NetworkConfig),
default=get_default("dropout", NetworkConfig),
help="Rate value applied to dropout layers in a CNN architecture.",
show_default=True,
)
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import click

from clinicadl.config.config.optimization import OptimizationConfig
from clinicadl.utils.config_utils import get_default_from_config_class as get_default
from clinicadl.utils.config_utils import get_type_from_config_class as get_type
from clinicadl.config.config_utils import get_default_from_config_class as get_default
from clinicadl.config.config_utils import get_type_from_config_class as get_type
from clinicadl.optimizer.optimization import OptimizationConfig

# Optimization
accumulation_steps = click.option(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import click

from clinicadl.config.config.optimizer import OptimizerConfig
from clinicadl.utils.config_utils import get_default_from_config_class as get_default
from clinicadl.utils.config_utils import get_type_from_config_class as get_type
from clinicadl.config.config_utils import get_default_from_config_class as get_default
from clinicadl.config.config_utils import get_type_from_config_class as get_type
from clinicadl.optimizer.optimizer import OptimizerConfig

# Optimizer
learning_rate = click.option(
Expand Down
Loading