Skip to content

Commit

Permalink
Add a CI runner with torchaudio absent
Browse files Browse the repository at this point in the history
  • Loading branch information
pzelasko committed Dec 6, 2023
1 parent 875a073 commit cf87813
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ jobs:
- python-version: "3.9"
torch-install-cmd: "pip install torch==1.8.2+cpu torchaudio==0.8.2 -f https://download.pytorch.org/whl/lts/1.8/torch_lts.html"
- python-version: "3.10"
torch-install-cmd: "pip install torch==1.12.1 torchaudio==0.12.1 torchdata==0.4.1 --extra-index-url https://download.pytorch.org/whl/cpu"
torch-install-cmd: "pip install torch==1.12.1 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cpu"
- python-version: "3.11"
torch-install-cmd: "pip install torch==2.0 torchaudio==2.0 torchdata==0.6 --extra-index-url https://download.pytorch.org/whl/cpu"
torch-install-cmd: "pip install torch==2.0 torchaudio==2.0 --extra-index-url https://download.pytorch.org/whl/cpu"
- python-version: "3.11"
torch-install-cmd: "pip install torch==2.0 --extra-index-url https://download.pytorch.org/whl/cpu"

fail-fast: false

Expand All @@ -49,7 +51,8 @@ jobs:
pip install wheel numpy
# Force the installation of a CPU-only PyTorch
${{ matrix.torch-install-cmd }}
pip install '.[tests]'
# the torchaudio env var does nothing when torchaudio is installed, but doesn't require it's presence when it's not
LHOTSE_REQUIRE_TORCHAUDIO=0 pip install '.[tests]'
# Enable some optional tests
pip install h5py dill smart_open[http] kaldifeat kaldi_native_io webdataset==0.2.5 s3prl scipy nara_wpe pyloudnorm
- name: Install sph2pipe
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
) # False = public release, True = otherwise


LHOTSE_USE_TORCHAUDIO = os.environ.get("LHOTSE_USE_TORCHAUDIO", "1") in (
LHOTSE_REQUIRE_TORCHAUDIO = os.environ.get("LHOTSE_REQUIRE_TORCHAUDIO", "1") in (
"1",
"True",
"true",
Expand Down Expand Up @@ -173,7 +173,7 @@ def mark_lhotse_version(version: str) -> None:
# Otherwise, we'll just install the latest versions from PyPI for the user.
import torch

if LHOTSE_USE_TORCHAUDIO:
if LHOTSE_REQUIRE_TORCHAUDIO:
try:
import torchaudio
except ImportError:
Expand All @@ -188,7 +188,7 @@ def mark_lhotse_version(version: str) -> None:
)
except ImportError:
extras = ["torch"]
if LHOTSE_USE_TORCHAUDIO:
if LHOTSE_REQUIRE_TORCHAUDIO:
extras.append("torchaudio")
install_requires.extend(extras)

Expand Down

0 comments on commit cf87813

Please sign in to comment.