diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 0aeaefd..6280c5d 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -28,7 +28,7 @@ jobs: run: | python -m pip install --upgrade pip python -m pip install flake8 pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + if [ -f environments/requirements.txt ]; then pip install -r environments/requirements.txt; fi python -m pip install . - name: Lint with flake8 run: | diff --git a/environment_cpu.yml b/environments/environment_cpu_apple.yml similarity index 79% rename from environment_cpu.yml rename to environments/environment_cpu_apple.yml index 8433250..38840a0 100644 --- a/environment_cpu.yml +++ b/environments/environment_cpu_apple.yml @@ -2,6 +2,8 @@ # Created Date: Saturday February 13th 2021 # Author: Steven Atkinson (steven@atkinson.mn) +# Environment for CPU and macOS (Intel and Apple Silicon) + name: nam channels: - conda-forge # pytest-mock @@ -19,6 +21,8 @@ dependencies: - pydantic - pytest - pytest-mock + # Performance note: + # https://github.com/sdatkinson/neural-amp-modeler/issues/505 - pytorch - scipy - semver diff --git a/environment_gpu.yml b/environments/environment_gpu.yml similarity index 100% rename from environment_gpu.yml rename to environments/environment_gpu.yml diff --git a/requirements.txt b/environments/requirements.txt similarity index 62% rename from requirements.txt rename to environments/requirements.txt index c7992f9..2d50816 100644 --- a/requirements.txt +++ b/environments/requirements.txt @@ -15,9 +15,10 @@ pytest-mock pytorch_lightning scipy sounddevice +# Performance note: https://github.com/sdatkinson/neural-amp-modeler/issues/505 torch -# Not required, but if you have it, it needs to be recent enough so I'm adding -# it. +# `transformers` is not required, but if you have it, it needs to be recent +# enough so I'm adding it. transformers>=4 tqdm wavio diff --git a/nam/models/_base.py b/nam/models/_base.py index 4a654b9..1054c93 100644 --- a/nam/models/_base.py +++ b/nam/models/_base.py @@ -209,6 +209,17 @@ def _forward_mps_safe(self, x: torch.Tensor, **kwargs) -> torch.Tensor: return self._forward(x, **kwargs) except NotImplementedError as e: if "Output channels > 65536 not supported at the MPS device." in str(e): + print( + "===WARNING===\n" + "NAM encountered a bug in PyTorch's MPS backend and will " + "switch to a fallback.\n" + f"Your version of PyTorch is {torch.__version__}.\n" + "Please report this in an Issue at:\n" + "https://github.com/sdatkinson/neural-amp-modeler/issues/new/choose" + "\n" + "so that NAM's dependencies can avoid buggy versions of " + "PyTorch and the associated performance hit." + ) self._mps_65536_fallback = True return self._forward_mps_safe(x, **kwargs) else: diff --git a/nam/models/base.py b/nam/models/base.py index 7bb1f83..6efa9ec 100644 --- a/nam/models/base.py +++ b/nam/models/base.py @@ -3,7 +3,7 @@ # Author: Steven Atkinson (steven@atkinson.mn) """ -Implements the base PyTorch Lightning model. +Implements the base PyTorch Lightning module. This is meant to combine an actual model (subclassed from `._base.BaseNet`) along with loss function boilerplate.