Skip to content

Commit

Permalink
Revert unwanted merge (#672)
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultdvx authored Oct 16, 2024
1 parent e73a148 commit 725a1af
Show file tree
Hide file tree
Showing 8 changed files with 1,630 additions and 1,641 deletions.
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

0 comments on commit 725a1af

Please sign in to comment.