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

Revert unwanted merge #672

Merged
merged 3 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.9', '3.10', '3.11', '3.12']
python-version: ['3.8', '3.9', '3.10', '3.11']
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_.value
template_name = template_

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

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

Expand Down
2 changes: 1 addition & 1 deletion clinicadl/network/cnn/random.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def fc_dict_design(n_fcblocks, convolutions, initial_shape, n_classes=2):
out_channels = last_conv["out_channels"]
flattened_shape = np.ceil(np.array(initial_shape) / 2**n_conv)
flattened_shape[0] = out_channels
in_features = np.prod(flattened_shape)
in_features = np.product(flattened_shape)

# Sample number of FC layers
ratio = (in_features / n_classes) ** (1 / n_fcblocks)
Expand Down
23 changes: 17 additions & 6 deletions clinicadl/trainer/tasks_utils.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
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.utils.data import Sampler, sampler
from torch.nn.modules.loss import _Loss
from torch.utils.data import DataLoader, 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 @@ -238,7 +249,7 @@ def save_outputs(network_task: Union[str, Task]):

def generate_test_row(
network_task: Union[str, Task],
mode: Mode,
mode: str,
metrics_module,
n_classes: int,
idx: int,
Expand All @@ -263,7 +274,7 @@ def generate_test_row(
[
data["participant_id"][idx],
data["session_id"][idx],
data[f"{mode.value}_id"][idx].item(),
data[f"{mode}_id"][idx].item(),
data["label"][idx].item(),
prediction,
]
Expand All @@ -275,7 +286,7 @@ def generate_test_row(
[
data["participant_id"][idx],
data["session_id"][idx],
data[f"{mode.value}_id"][idx].item(),
data[f"{mode}_id"][idx].item(),
data["label"][idx].item(),
outputs[idx].item(),
]
Expand All @@ -287,7 +298,7 @@ def generate_test_row(
row = [
data["participant_id"][idx],
data["session_id"][idx],
data[f"{mode.value}_id"][idx].item(),
data[f"{mode}_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.11
conda create --name clinicadlEnv python=3.8
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.11
- python=3.9
3,224 changes: 1,601 additions & 1,623 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.9,<3.13"
torch = "^2.3.0"
python = ">=3.8,<3.12"
torch = "^2.1.0"
torchvision = "*"
tensorboard = "*"
toml = "*"
pandas = "^2"
numpy = "^2"
scikit-learn = "^1"
scikit-image = "^0.24"
pandas = "^1.2"
numpy = "^1.17"
scikit-learn = "^1.0"
scikit-image = "^0.21"
joblib = "^1.2.0"
click = "^8"
click-option-group = "^0.5"
Expand Down
Loading