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

Drop python 3.8 and support python 3.12 #671

Merged
merged 2 commits into from
Oct 16, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- uses: snok/install-poetry@v1
Expand Down
4 changes: 2 additions & 2 deletions clinicadl/caps_dataset/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,11 +580,11 @@ def _get_mask_paths_and_tensors(
else:
for template_ in Template:
if preprocessing_.name == template_.name:
template_name = template_
template_name = template_.value

for pattern_ in Pattern:
if preprocessing_.name == pattern_.name:
pattern = pattern_
pattern = pattern_.value

mask_location = caps_directory / "masks" / f"tpl-{template_name}"

Expand Down
23 changes: 6 additions & 17 deletions clinicadl/trainer/tasks_utils.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,20 @@
from abc import abstractmethod
from typing import Any, Dict, List, Optional, Sequence, Tuple, Type, Union

import numpy as np
import pandas as pd
import torch
import torch.distributed as dist
from pydantic import (
BaseModel,
ConfigDict,
computed_field,
model_validator,
)
from torch import Tensor, nn
from torch.amp import autocast
from torch.nn.functional import softmax
from torch.nn.modules.loss import _Loss
from torch.utils.data import DataLoader, Sampler, sampler
from torch.utils.data import Sampler, sampler
from torch.utils.data.distributed import DistributedSampler

from clinicadl.caps_dataset.data import CapsDataset
from clinicadl.metrics.metric_module import MetricModule
from clinicadl.network.network import Network
from clinicadl.trainer.config.train import TrainConfig
from clinicadl.utils import cluster
from clinicadl.utils.enum import (
ClassificationLoss,
ClassificationMetric,
Mode,
ReconstructionLoss,
ReconstructionMetric,
RegressionLoss,
Expand Down Expand Up @@ -249,7 +238,7 @@ def save_outputs(network_task: Union[str, Task]):

def generate_test_row(
network_task: Union[str, Task],
mode: str,
mode: Mode,
metrics_module,
n_classes: int,
idx: int,
Expand All @@ -274,7 +263,7 @@ def generate_test_row(
[
data["participant_id"][idx],
data["session_id"][idx],
data[f"{mode}_id"][idx].item(),
data[f"{mode.value}_id"][idx].item(),
data["label"][idx].item(),
prediction,
]
Expand All @@ -286,7 +275,7 @@ def generate_test_row(
[
data["participant_id"][idx],
data["session_id"][idx],
data[f"{mode}_id"][idx].item(),
data[f"{mode.value}_id"][idx].item(),
data["label"][idx].item(),
outputs[idx].item(),
]
Expand All @@ -298,7 +287,7 @@ def generate_test_row(
row = [
data["participant_id"][idx],
data["session_id"][idx],
data[f"{mode}_id"][idx].item(),
data[f"{mode.value}_id"][idx].item(),
]

for metric in evaluation_metrics(Task.RECONSTRUCTION):
Expand Down
2 changes: 1 addition & 1 deletion docs/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ bash /tmp/miniconda-installer.sh
The latest release of ClinicaDL can be installed using `pip` as follows:

```{.sourceCode .bash}
conda create --name clinicadlEnv python=3.8
conda create --name clinicadlEnv python=3.11
conda activate clinicadlEnv
pip install clinicadl
```
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ channels:
- defaults
- conda-forge
dependencies:
- python=3.9
- python=3.11
3,224 changes: 1,623 additions & 1,601 deletions poetry.lock

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ classifiers = [
]

[tool.poetry.dependencies]
python = ">=3.8,<3.12"
torch = "^2.1.0"
python = ">=3.9,<3.13"
torch = "^2.3.0"
torchvision = "*"
tensorboard = "*"
toml = "*"
pandas = "^1.2"
numpy = "^1.17"
scikit-learn = "^1.0"
scikit-image = "^0.21"
pandas = "^2"
numpy = "^2"
scikit-learn = "^1"
scikit-image = "^0.24"
joblib = "^1.2.0"
click = "^8"
click-option-group = "^0.5"
Expand Down
Loading