Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into feature/classificat…
Browse files Browse the repository at this point in the history
…ion_evaluation
  • Loading branch information
fcogidi committed Oct 15, 2024
2 parents 8e91fe7 + b291ea0 commit 88b1175
Show file tree
Hide file tree
Showing 52 changed files with 2,077 additions and 1,581 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/code_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ jobs:
run-code-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.7
- uses: actions/checkout@v4.2.1
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- uses: actions/setup-python@v5.1.1
- uses: actions/setup-python@v5.2.0
with:
python-version: '3.9'
python-version: '3.10'
cache: 'poetry'
- name: Install dependencies and check code
run: |
poetry env use '3.9'
poetry env use '3.10'
source .venv/bin/activate
poetry install --with test --all-extras
pre-commit run --all-files
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ jobs:
integration-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1
- uses: actions/checkout@v4.2.1
- name: Install poetry
run: python3 -m pip install --upgrade pip && python3 -m pip install poetry
- uses: actions/setup-python@v5.0.0
- uses: actions/setup-python@v5.2.0
with:
python-version: '3.9'
python-version: '3.10'
- name: Install dependencies and check code
run: |
poetry env use '3.9'
poetry env use '3.10'
source $(poetry env info --path)/bin/activate
poetry install --with test
pytest -m integration_test
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install libcurl4-openssl-dev libssl-dev
- uses: actions/checkout@v4.1.1
- uses: actions/checkout@v4.2.1
- name: Install poetry
run: python3 -m pip install --upgrade pip && python3 -m pip install poetry
- uses: actions/setup-python@v5.1.1
- uses: actions/setup-python@v5.2.0
with:
python-version: '3.9'
python-version: '3.10'
- name: Build package
run: poetry build
- name: Publish package
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0 # Use the ref you want to point at
rev: v5.0.0 # Use the ref you want to point at
hooks:
- id: trailing-whitespace
- id: check-ast
Expand All @@ -22,7 +22,7 @@ repos:
args: [--lock]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.1
rev: v0.6.9
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand All @@ -31,13 +31,13 @@ repos:
types_or: [ python, pyi, jupyter ]

- repo: https://github.com/crate-ci/typos
rev: v1.23.6
rev: v1.26.0
hooks:
- id: typos
args: []

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.1
rev: v1.11.2
hooks:
- id: mypy
entry: mypy
Expand All @@ -46,7 +46,7 @@ repos:
exclude: tests|projects

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.8.7
rev: 1.9.0
hooks:
- id: nbqa-ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ experimentation and research for new techniques.
## Quick Start
### Installation
#### Prerequisites
The library requires Python 3.9 or later. We recommend using a virtual environment to manage dependencies. You can create
The library requires Python 3.10 or later. We recommend using a virtual environment to manage dependencies. You can create
a virtual environment using the following command:
```bash
python3 -m venv /path/to/new/virtual/environment
Expand Down
3 changes: 2 additions & 1 deletion mmlearn/conf/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Hydra/Hydra-zen-based configurations."""

import functools
import os
import warnings
from dataclasses import dataclass, field
from enum import Enum
Expand Down Expand Up @@ -29,7 +30,7 @@

def _get_default_ckpt_dir() -> Any:
"""Get the default checkpoint directory."""
return SI("/checkpoint/${oc.env:USER}/${oc.env:SLURM_JOB_ID}")
return SI("${hydra:runtime.output_dir}/checkpoints")


_DataLoaderConf = builds(
Expand Down
2 changes: 1 addition & 1 deletion mmlearn/datasets/chexpert.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def __getitem__(self, idx: int) -> Example:

return Example(
{
Modalities.RGB: image,
Modalities.RGB.name: image,
Modalities.RGB.target: label,
"qid": entry["qid"],
EXAMPLE_INDEX_KEY: idx,
Expand Down
8 changes: 4 additions & 4 deletions mmlearn/datasets/core/data_collator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

from collections.abc import Mapping
from dataclasses import dataclass
from typing import Any, Callable, Optional, Union
from typing import Any, Callable, Optional

from torch.utils.data import default_collate

from mmlearn.datasets.core.example import Example
from mmlearn.datasets.core.modalities import Modalities, Modality
from mmlearn.datasets.core.modalities import Modalities


@dataclass
Expand Down Expand Up @@ -43,9 +43,9 @@ def __call__(self, examples: list[Example]) -> dict[str, Any]:

if self.batch_processors is not None:
for key, processor in self.batch_processors.items():
batch_key: Union[str, Modality] = key
batch_key: str = key
if Modalities.has_modality(key):
batch_key = Modalities.get_modality(key)
batch_key = Modalities.get_modality(key).name

if batch_key in batch:
batch_processed = processor(batch[batch_key])
Expand Down
Loading

0 comments on commit 88b1175

Please sign in to comment.