From ee66a2f42845be512b65fb398c75ba06e94cea23 Mon Sep 17 00:00:00 2001 From: slashtechno <77907286+slashtechno@users.noreply.github.com> Date: Sat, 9 Mar 2024 19:38:05 -0600 Subject: [PATCH] Install from `pytorch-cpu` when on Windows --- poetry.lock | 4 ++-- pyproject.toml | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/poetry.lock b/poetry.lock index 6cf8f98..4841d9b 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2096,8 +2096,8 @@ files = [ [package.dependencies] numpy = [ {version = ">=1.23.5", markers = "python_version >= \"3.11\""}, - {version = ">=1.21.4", markers = "python_version >= \"3.10\" and platform_system == \"Darwin\" and python_version < \"3.11\""}, {version = ">=1.21.2", markers = "platform_system != \"Darwin\" and python_version >= \"3.10\" and python_version < \"3.11\""}, + {version = ">=1.21.4", markers = "python_version >= \"3.10\" and platform_system == \"Darwin\" and python_version < \"3.11\""}, ] [[package]] @@ -3855,4 +3855,4 @@ cuda = [] [metadata] lock-version = "2.0" python-versions = ">=3.10, <3.12" -content-hash = "e40609bfdd173f240b5e5bcca80d0ee27a573bad0340d8790a1c9ae1272e55d8" +content-hash = "9ac2036a11ad1ed50d37b455539316efdeed714e6d5e8b9b001a85a2f753b37b" diff --git a/pyproject.toml b/pyproject.toml index 016cc91..6d2c933 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,9 +24,10 @@ numpy = "^1.23.2" # https://github.com/python-poetry/poetry/issues/6409#issuecomment-1911735833 # If GPU support doesn't work, `poetry install -E cuda --with gpu` will force it to be installed from the GPU PyTorch repo # However, PyPi's `torch` has CUDA 12.1 support by default on Linux, so in that case it should not be needed. -torch = "^2.2.1" -#torch = {version = "^2.2.1", source = "pytorch-cpu", markers = "extra!='cuda'" } - +torch = [ + {version = "^2.2.1", markers = "extra!='cuda' and platform_system=='Linux'"}, + {version = "^2.2.1", source = "pytorch-cpu", markers = "extra!='cuda' and platform_system!='Linux'"}, + ] # https://stackoverflow.com/a/76477590/18270659 # https://discfuss.tensorflow.org/t/tensorflow-io-gcs-filesystem-with-windows/18849/4 # https://github.com/python-poetry/poetry/issues/8271#issuecomment-1712020965