diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 970fe7c6..43a6d1c2 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.3.0 +current_version = 0.4.0 commit = True tag = False message = "build: Bump version {current_version} → {new_version}" diff --git a/.github/workflows/python-coverage-report.yml b/.github/workflows/python-coverage-report.yml index 93e5b22c..bf0f9eb3 100644 --- a/.github/workflows/python-coverage-report.yml +++ b/.github/workflows/python-coverage-report.yml @@ -10,22 +10,21 @@ jobs: strategy: matrix: include: - - python-version: 3.9 - tf-version: 2.11 - torch-version: 1.12 + - python-version: "3.10" + tf-version: "2.15" + torch-version: "2.2" steps: - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - name: Install dependencies + shell: bash -el {0} run: | python -m pip install --upgrade pip - pip install --upgrade uv tox tox-uv + python -m pip install --upgrade uv tox tox-uv - name: Get coverage xml (Python ${{ matrix.python-version }} - TensorFlow ${{ matrix.tf-version }} - Torch ${{ matrix.torch-version }}) - run: tox -e py$(echo ${{ matrix.python-version }}-tf${{ matrix.tf-version }}-torch${{ matrix.torch-version }}-coverage | tr -d .) + shell: bash -el {0} + run: | + python -m tox -e py$(echo ${{ matrix.python-version }}-tf${{ matrix.tf-version }}-torch${{ matrix.torch-version }}-coverage | tr -d .) - name: Get Cover uses: orgoro/coverage@v3 with: diff --git a/.github/workflows/python-linters.yml b/.github/workflows/python-linters.yml index f6b1f9aa..3dd0d4f3 100644 --- a/.github/workflows/python-linters.yml +++ b/.github/workflows/python-linters.yml @@ -12,7 +12,7 @@ jobs: strategy: max-parallel: 4 matrix: - python-version: ["3.8", "3.9", "3.10"] + python-version: ["3.9", "3.10", "3.11"] steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/python-tests-tf.yml b/.github/workflows/python-tests-tf.yml index 937f7941..c88f1f21 100644 --- a/.github/workflows/python-tests-tf.yml +++ b/.github/workflows/python-tests-tf.yml @@ -15,22 +15,21 @@ jobs: max-parallel: 4 matrix: include: - - python-version: 3.8 - tf-version: 2.5 - - python-version: 3.9 - tf-version: 2.8 - - python-version: "3.10" + - python-version: "3.9" tf-version: 2.11 + - python-version: "3.10" + tf-version: 2.13 + - python-version: "3.11" + tf-version: 2.15 steps: - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - name: Install dependencies + shell: bash -el {0} run: | python -m pip install --upgrade pip - pip install --upgrade uv tox tox-uv + python -m pip install --upgrade uv tox tox-uv - name: Test with tox (Python ${{ matrix.python-version }} - TensorFlow ${{ matrix.tf-version }}) - run: tox -e py$(echo ${{ matrix.python-version }}-tf${{ matrix.tf-version }} | tr -d .) + shell: bash -el {0} + run: | + python -m tox -e py$(echo ${{ matrix.python-version }}-tf${{ matrix.tf-version }} | tr -d .) diff --git a/.github/workflows/python-tests-torch.yml b/.github/workflows/python-tests-torch.yml index 3fc30549..cdf6a5b7 100644 --- a/.github/workflows/python-tests-torch.yml +++ b/.github/workflows/python-tests-torch.yml @@ -15,22 +15,21 @@ jobs: max-parallel: 4 matrix: include: - - python-version: 3.8 - torch-version: 1.11 - - python-version: 3.9 - torch-version: 1.13 - - python-version: "3.10" + - python-version: "3.9" torch-version: 2.0.0 + - python-version: "3.10" + torch-version: 2.4 + - python-version: "3.11" + torch-version: 2.6 steps: - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - name: Install dependencies + shell: bash -el {0} run: | python -m pip install --upgrade pip - pip install --upgrade uv tox tox-uv + python -m pip install --upgrade uv tox tox-uv - name: Test with tox (Python ${{ matrix.python-version }} - Pytorch ${{ matrix.torch-version }}) - run: tox -e py$(echo ${{ matrix.python-version }}-torch${{ matrix.torch-version }} | tr -d .) + shell: bash -el {0} + run: | + python -m tox -e py$(echo ${{ matrix.python-version }}-torch${{ matrix.torch-version }} | tr -d .) diff --git a/README.md b/README.md index 206aa443..56b816c1 100644 --- a/README.md +++ b/README.md @@ -64,9 +64,9 @@ oodeel requires either `tensorflow` or `pytorch` to be already installed (it wil |Python version|Pytorch version|Tensorflow version| |---|---|---| -|`3.8`| `1.11`| `2.5`| -|`3.9`|`1.13` | `2.8`| -|`3.10`| `2.00` | `2.11`| +|`3.9`| `2.0`| `2.11`| +|`3.10`|`2.4` | `2.13`| +|`3.11`| `2.6` | `2.15`| # Quick Start diff --git a/docs/index.md b/docs/index.md index 328e8351..c0b44010 100644 --- a/docs/index.md +++ b/docs/index.md @@ -65,9 +65,9 @@ oodeel requires either `tensorflow` or `pytorch` to be already installed (it wil |Python version|Pytorch version|Tensorflow version| |---|---|---| -|`3.8`| `1.11`| `2.5`| -|`3.9`|`1.13` | `2.8`| -|`3.10`| `2.00` | `2.11`| +|`3.9`| `2.0`| `2.11`| +|`3.10`|`2.4` | `2.13`| +|`3.11`| `2.6` | `2.15`| # Quick Start diff --git a/oodeel/__init__.py b/oodeel/__init__.py index 56db8f20..2f62c725 100644 --- a/oodeel/__init__.py +++ b/oodeel/__init__.py @@ -25,4 +25,4 @@ ------- """ -__version__ = "0.3.0" +__version__ = "0.4.0" diff --git a/setup.cfg b/setup.cfg index 736232a2..63b895d1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,7 +3,7 @@ max-line-length = 88 extend-ignore = # See https://github.com/PyCQA/pycodestyle/issues/373 - E203, + E203 per-file-ignores = */__init__.py: F401 @@ -37,91 +37,94 @@ exclude_also = except ImportError [tox:tox] -envlist = py{38,39,310}-tf{24,25,27,28,211},py{38,39,310}-torch{17,19,110,113,200},py{38,39,310}-lint,py{39}-tf{211}-torch{112}-coverage +envlist = py{39,310,311}-tf{211,213,214,215},py{39,310,311}-torch{113,200,22,24,26},py{39,310,311}-lint,py{39}-tf{215}-torch{202}-coverage -[testenv:py{38,39,310}-tf{24,25,27,28,211}] +[testenv:py{39,310,311}-tf{211,213,214,215}] deps = packaging - faiss_gpu scikit_learn scipy setuptools pytest kneed tqdm - protobuf <=3.20 pandas seaborn requests plotly == 5.15.0 - tf24: tensorflow ~= 2.4.0 - tf24: tensorflow_datasets ~= 4.3.0 - tf24: tensorflow_probability ~= 0.12.2 - tf25: tensorflow ~= 2.5.0 - tf25: tensorflow_datasets ~= 4.3.0 - tf25: tensorflow_probability ~= 0.13.0 - tf27: tensorflow ~= 2.7.0 - tf27: tensorflow_datasets - tf27: tensorflow_probability ~= 0.15.0 - tf28: tensorflow ~= 2.8.0 - tf28: tensorflow_datasets - tf28: tensorflow_probability ~= 0.16.0 + tf211: protobuf>=3.9.2,<3.20 + tf213: protobuf>=3.20.3,<4.21.0 + tf214: protobuf>=3.20.3,<4.21.0 + tf215: protobuf>=3.20.3,<4.21.0 + tf211: numpy~=1.23.5 + tf213: numpy~=1.24.3 + tf214: numpy~=1.24.3 + tf215: numpy~=1.26.0 tf211: tensorflow ~= 2.11.0 tf211: tensorflow_datasets tf211: tensorflow_probability ~= 0.19.0 + tf213: tensorflow ~= 2.13.0 + tf213: tensorflow_datasets + tf213: tensorflow_probability ~= 0.21.0 + tf214: tensorflow ~= 2.14.0 + tf214: tensorflow_datasets + tf214: tensorflow_probability ~= 0.22.0 + tf215: tensorflow ~= 2.15.0 + tf215: tensorflow_datasets + tf215: tensorflow_probability ~= 0.23.0 install_command = uv pip install {opts} {packages} setenv = DL_LIB = tensorflow commands = - tf24: uv pip install --force-reinstall numpy==1.21.0 - tf25: uv pip install --force-reinstall numpy==1.21.0 - tf28: uv pip install --force-reinstall numpy==1.24.0 - tf211: uv pip install --force-reinstall numpy==1.26.0 + py39,py310,py311: uv pip install faiss-cpu==1.7.4 + tf211: uv pip install --force-reinstall numpy==1.24.0 + tf213: uv pip install --force-reinstall numpy==1.24.0 + tf214: uv pip install --force-reinstall numpy==1.24.0 + tf215: uv pip install --force-reinstall numpy==1.26.0 pytest tests/tests_tensorflow -[testenv:py{38,39,310}-torch{17,19,110,111,113,200}] +[testenv:py{39,310,311}-torch{113,200,22,24,26}] deps = packaging - faiss_gpu scikit_learn scipy setuptools pytest kneed tqdm - protobuf <=3.20 + protobuf>=3.20.3,<4.21.0 pandas seaborn requests plotly == 5.15.0 - torch17: torch == 1.7.1+cpu - torch17: torchvision == 0.8.2+cpu - torch17: transformers == 4.30.0 - torch19: torch == 1.9.1+cpu - torch19: torchvision == 0.10.1+cpu - torch19: transformers == 4.30.0 - torch110: torch == 1.10.1+cpu - torch110: torchvision == 0.11.2+cpu - torch110: transformers == 4.40.0 - torch111: torch == 1.11.0+cpu - torch111: transformers == 4.43.0 - torch111: torchvision == 0.12.0+cpu torch113: torch == 1.13.1+cpu torch113: torchvision == 0.14.1+cpu torch113: transformers == 4.43.0 torch200: torch == 2.0.0+cpu torch200: torchvision == 0.15.0+cpu torch200: transformers == 4.49.0 + torch22: torch == 2.2.0+cpu + torch22: torchvision == 0.17.0+cpu + torch22: transformers == 4.49.0 + torch24: torch == 2.4.0+cpu + torch24: torchvision == 0.19.0+cpu + torch24: transformers == 4.49.0 + torch26: torch == 2.6.0+cpu + torch26: torchvision == 0.21.0+cpu + torch26: transformers == 4.49.0 install_command = uv pip install --extra-index-url https://download.pytorch.org/whl/cpu {opts} {packages} setenv = DL_LIB = torch commands = - torch111: uv pip install --force-reinstall numpy==1.21.0 + py39,py310,py311: uv pip install faiss-cpu==1.7.4 torch113: uv pip install --force-reinstall numpy==1.24.0 torch200: uv pip install --force-reinstall numpy==1.26.0 + torch22: uv pip install --force-reinstall numpy==1.26.0 + torch24: uv pip install --force-reinstall numpy==1.26.0 + torch26: uv pip install --force-reinstall numpy==1.26.0 pytest tests/tests_torch -[testenv:py{38,39,310}-lint] +[testenv:py{39,310,311}-lint] deps = black flake8 @@ -133,7 +136,7 @@ commands = flake8 oodeel tests # mypy --namespace-packages oodeel tests -[testenv:py{39}-tf{211}-torch{112}-coverage] +[testenv:py{310}-tf{215}-torch{22}-coverage] deps = packaging faiss_gpu @@ -143,21 +146,21 @@ deps = pytest kneed tqdm - protobuf <=3.20 + protobuf>=3.20.3,<4.21.0 coverage pandas seaborn plotly == 5.15.0 - torch112: torch == 1.12.0+cpu - torch112: torchvision == 0.13.0+cpu - torch112: transformers == 4.43.0 - tf211: tensorflow ~= 2.11.0 - tf211: tensorflow_datasets - tf211: tensorflow_probability ~= 0.19.0 + torch22: torch == 2.2.0+cpu + torch22: torchvision == 0.17.0+cpu + torch22: transformers == 4.49.0 + tf215: tensorflow ~= 2.15.0 + tf215: tensorflow_datasets + tf215: tensorflow_probability ~= 0.23.0 install_command = uv pip install --extra-index-url https://download.pytorch.org/whl/cpu {opts} {packages} setenv = DL_LIB = both commands = - tf211: uv pip install --force-reinstall numpy==1.26.0 + tf215: uv pip install --force-reinstall numpy==1.26.0 coverage run --source oodeel -m pytest coverage xml diff --git a/setup.py b/setup.py index f9cd73e4..9511939b 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,6 @@ long_description = f.read() requirements = [ - "faiss_gpu", "numpy <= 1.26.4", "scikit_learn", "scipy", @@ -93,7 +92,7 @@ # Name of the package: name="oodeel", # Version of the package: - version="0.3.0", + version="0.4.0", # Find the package automatically (include everything): packages=find_packages(), # Author information: diff --git a/tests/tests_tensorflow/datasets/test_tf_datahandler.py b/tests/tests_tensorflow/datasets/test_tf_datahandler.py index 1dc2d77d..89e96b5a 100644 --- a/tests/tests_tensorflow/datasets/test_tf_datahandler.py +++ b/tests/tests_tensorflow/datasets/test_tf_datahandler.py @@ -363,11 +363,13 @@ def map_fn_b(item): # prepare dataloader loader = handler.prepare(dataset_b, 64, shuffle=True) batch = next(iter(loader)) - assert batch[0].shape == tf.TensorShape([64, *x_shape]) + assert batch[0].shape == tf.TensorShape([min(64, num_samples_b), *x_shape]) assert batch[1].shape == ( - tf.TensorShape([64, num_labels]) if one_hot else tf.TensorShape([64]) + tf.TensorShape([min(64, num_samples_b), num_labels]) + if one_hot + else tf.TensorShape([min(64, num_samples_b)]) ) - assert batch[2].shape == tf.TensorShape([64]) + assert batch[2].shape == tf.TensorShape([min(64, num_samples_b)]) def test_instanciate_from_tfds(): diff --git a/tests/tests_torch/datasets/test_torch_datahandler.py b/tests/tests_torch/datasets/test_torch_datahandler.py index bb1a9d96..08570d70 100644 --- a/tests/tests_torch/datasets/test_torch_datahandler.py +++ b/tests/tests_torch/datasets/test_torch_datahandler.py @@ -352,11 +352,13 @@ def map_fn_b(item): # prepare dataloader loader = handler.prepare(dataset_b, 64, shuffle=True) batch = next(iter(loader)) - assert batch[0].shape == torch.Size([64, *x_shape]) + assert batch[0].shape == torch.Size([min(64, num_samples_b), *x_shape]) assert batch[1].shape == ( - torch.Size([64, num_labels]) if one_hot else torch.Size([64]) + torch.Size([min(64, num_samples_b), num_labels]) + if one_hot + else torch.Size([min(64, num_samples_b)]) ) - assert batch[2].shape == torch.Size([64]) + assert batch[2].shape == torch.Size([min(64, num_samples_b)]) @pytest.mark.parametrize(