This is an automated email from the ASF dual-hosted git repository.
guanmingchiu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/mahout.git
The following commit(s) were added to refs/heads/main by this push:
new 5b970baba [QDP] Upgrade tch to 0.22 (#872)
5b970baba is described below
commit 5b970baba8f1a71b21919281d37bcca9de624ac3
Author: Guan-Ming (Wesley) Chiu <[email protected]>
AuthorDate: Mon Jan 19 17:29:50 2026 +0800
[QDP] Upgrade tch to 0.22 (#872)
* Upgrade tch to 0.22
* Update ci
* Update contrubuting.md
---
.github/workflows/pre-commit.yml | 13 +++--------
CONTRIBUTING.md | 6 +++++
pyproject.toml | 3 ++-
qdp/Cargo.lock | 23 +++++---------------
qdp/Cargo.toml | 2 +-
qdp/qdp-python/pyproject.toml | 2 +-
uv.lock | 47 ++++++++++++++++++----------------------
7 files changed, 39 insertions(+), 57 deletions(-)
diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml
index 8ce0f23d2..0cc10b56a 100644
--- a/.github/workflows/pre-commit.yml
+++ b/.github/workflows/pre-commit.yml
@@ -41,16 +41,9 @@ jobs:
run: pip install uv
- name: Install dependencies
- run: uv sync --group dev
-
- - name: Install libtorch (CPU)
- run: |
- set -euo pipefail
- libtorch_version="2.2.0"
-
libtorch_zip="libtorch-cxx11-abi-shared-with-deps-${libtorch_version}%2Bcpu.zip"
- curl -L -o libtorch.zip
"https://download.pytorch.org/libtorch/cpu/${libtorch_zip}"
- unzip -q libtorch.zip
- echo "LIBTORCH=${GITHUB_WORKSPACE}/libtorch" >> "$GITHUB_ENV"
+ run: uv sync --extra qdp --group dev
- name: Run pre-commit hooks
run: uv run pre-commit run --all-files
+ env:
+ LIBTORCH_USE_PYTORCH: 1
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index bbff5bd84..40d8e0483 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -81,6 +81,12 @@ See [testing/README.md](testing/README.md) for detailed
testing documentation.
### 2.4 Pre-commit Checks
+Set the environment variable for PyTorch detection (required for Rust clippy):
+
+```bash
+export LIBTORCH_USE_PYTORCH=1
+```
+
Run pre-commit hooks:
```bash
diff --git a/pyproject.toml b/pyproject.toml
index 4286a5ab1..76493db0e 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -24,8 +24,9 @@ dev = [
"pre-commit>=3.0.0",
"maturin>=1.10.2",
"patchelf>=0.17.2.4",
- "torch>=2.2",
+ "torch>=2.2,<=2.9.0",
"numpy>=1.24,<2.0",
+ "setuptools>=80.9.0",
]
[tool.uv]
diff --git a/qdp/Cargo.lock b/qdp/Cargo.lock
index c78ac09f8..dc937c4ea 100644
--- a/qdp/Cargo.lock
+++ b/qdp/Cargo.lock
@@ -979,19 +979,6 @@ version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d87ecb2933e8aeadb3e3a02b828fed80a7528047e68b4f424523a0981a3a084"
-[[package]]
-name = "ndarray"
-version = "0.15.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "adb12d4e967ec485a5f71c6311fe28158e9d6f4bc4a447b474184d0f91a8fa32"
-dependencies = [
- "matrixmultiply",
- "num-complex",
- "num-integer",
- "num-traits",
- "rawpointer",
-]
-
[[package]]
name = "ndarray"
version = "0.16.1"
@@ -1837,14 +1824,14 @@ checksum =
"b1dd07eb858a2067e2f3c7155d54e929265c264e6f37efe3ee7a8d1b5a1dd0ba"
[[package]]
name = "tch"
-version = "0.15.0"
+version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7c7cb00bc2770454b515388d45be7097a3ded2eca172f3dcdb7ca4cc06c40bf1"
+checksum = "9e09b91610202dc4820c21eb474a42b386ef69f323b1c0902b5472ba7456ebb5"
dependencies = [
"half",
"lazy_static",
"libc",
- "ndarray 0.15.6",
+ "ndarray 0.16.1",
"rand",
"safetensors",
"thiserror 1.0.69",
@@ -1946,9 +1933,9 @@ dependencies = [
[[package]]
name = "torch-sys"
-version = "0.15.0"
+version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "29e0244e5b148a31dd7fe961165037d1927754d024095c1013937532d7e73a22"
+checksum = "aef40c585e342df95b66a1fa7c923188623999c2b657227befb481dfb03a6a42"
dependencies = [
"anyhow",
"cc",
diff --git a/qdp/Cargo.toml b/qdp/Cargo.toml
index c2acf6ffc..af83578da 100644
--- a/qdp/Cargo.toml
+++ b/qdp/Cargo.toml
@@ -36,7 +36,7 @@ prost = "0.12"
prost-build = "0.12"
bytes = "1.5"
# PyTorch tensor loading (optional)
-tch = "0.15"
+tch = "0.22"
# Optional: vendored protoc to avoid build failures when protoc is missing
protoc-bin-vendored = "3"
diff --git a/qdp/qdp-python/pyproject.toml b/qdp/qdp-python/pyproject.toml
index 2ebb87262..e518949d0 100644
--- a/qdp/qdp-python/pyproject.toml
+++ b/qdp/qdp-python/pyproject.toml
@@ -18,7 +18,7 @@ benchmark = [
"pandas>=2.0",
"pyarrow>=14.0",
"tensorflow>=2.20",
- "torch>=2.2",
+ "torch>=2.2,<=2.9.0",
"qiskit>=1.0",
"qiskit-aer>=0.17.2",
"pennylane>=0.35",
diff --git a/uv.lock b/uv.lock
index f0c4224e0..28c796bcd 100644
--- a/uv.lock
+++ b/uv.lock
@@ -1685,6 +1685,7 @@ dev = [
{ name = "pre-commit" },
{ name = "pytest" },
{ name = "ruff" },
+ { name = "setuptools" },
{ name = "torch" },
]
@@ -1707,7 +1708,8 @@ dev = [
{ name = "pre-commit", specifier = ">=3.0.0" },
{ name = "pytest", specifier = ">=9.0.1" },
{ name = "ruff", specifier = ">=0.13.1" },
- { name = "torch", specifier = ">=2.2" },
+ { name = "setuptools", specifier = ">=80.9.0" },
+ { name = "torch", specifier = ">=2.2,<=2.9.0" },
]
[[package]]
@@ -1727,16 +1729,9 @@ benchmark = [
{ name = "qiskit-aer", specifier = ">=0.17.2" },
{ name = "scikit-learn", specifier = ">=1.3" },
{ name = "tensorflow", specifier = ">=2.20" },
- { name = "torch", specifier = ">=2.2" },
+ { name = "torch", specifier = ">=2.2,<=2.9.0" },
{ name = "tqdm" },
]
-dev = [
- { name = "maturin", specifier = ">=1.10.2" },
- { name = "numpy", specifier = ">=1.24,<2.0" },
- { name = "patchelf", specifier = ">=0.17.2.4" },
- { name = "pytest", specifier = ">=9.0.1" },
- { name = "torch", specifier = ">=2.2" },
-]
[[package]]
name = "requests"
@@ -1978,7 +1973,7 @@ wheels = [
[[package]]
name = "torch"
-version = "2.9.1"
+version = "2.9.0"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "filelock" },
@@ -2007,18 +2002,18 @@ dependencies = [
{ name = "typing-extensions" },
]
wheels = [
- { url =
"https://files.pythonhosted.org/packages/5f/56/9577683b23072075ed2e40d725c52c2019d71a972fab8e083763da8e707e/torch-2.9.1-cp310-cp310-manylinux_2_28_aarch64.whl",
hash =
"sha256:1cc208435f6c379f9b8fdfd5ceb5be1e3b72a6bdf1cb46c0d2812aa73472db9e", size
= 104207681, upload-time = "2025-11-12T15:19:56.48Z" },
- { url =
"https://files.pythonhosted.org/packages/38/45/be5a74f221df8f4b609b78ff79dc789b0cc9017624544ac4dd1c03973150/torch-2.9.1-cp310-cp310-manylinux_2_28_x86_64.whl",
hash =
"sha256:9fd35c68b3679378c11f5eb73220fdcb4e6f4592295277fbb657d31fd053237c", size
= 899794036, upload-time = "2025-11-12T15:21:01.886Z" },
- { url =
"https://files.pythonhosted.org/packages/67/95/a581e8a382596b69385a44bab2733f1273d45c842f5d4a504c0edc3133b6/torch-2.9.1-cp310-cp310-win_amd64.whl",
hash =
"sha256:2af70e3be4a13becba4655d6cc07dcfec7ae844db6ac38d6c1dafeb245d17d65", size
= 110969861, upload-time = "2025-11-12T15:21:30.145Z" },
- { url =
"https://files.pythonhosted.org/packages/ad/51/1756dc128d2bf6ea4e0a915cb89ea5e730315ff33d60c1ff56fd626ba3eb/torch-2.9.1-cp310-none-macosx_11_0_arm64.whl",
hash =
"sha256:a83b0e84cc375e3318a808d032510dde99d696a85fe9473fc8575612b63ae951", size
= 74452222, upload-time = "2025-11-12T15:20:46.223Z" },
- { url =
"https://files.pythonhosted.org/packages/15/db/c064112ac0089af3d2f7a2b5bfbabf4aa407a78b74f87889e524b91c5402/torch-2.9.1-cp311-cp311-manylinux_2_28_aarch64.whl",
hash =
"sha256:62b3fd888277946918cba4478cf849303da5359f0fb4e3bfb86b0533ba2eaf8d", size
= 104220430, upload-time = "2025-11-12T15:20:31.705Z" },
- { url =
"https://files.pythonhosted.org/packages/56/be/76eaa36c9cd032d3b01b001e2c5a05943df75f26211f68fae79e62f87734/torch-2.9.1-cp311-cp311-manylinux_2_28_x86_64.whl",
hash =
"sha256:d033ff0ac3f5400df862a51bdde9bad83561f3739ea0046e68f5401ebfa67c1b", size
= 899821446, upload-time = "2025-11-12T15:20:15.544Z" },
- { url =
"https://files.pythonhosted.org/packages/47/cc/7a2949e38dfe3244c4df21f0e1c27bce8aedd6c604a587dd44fc21017cb4/torch-2.9.1-cp311-cp311-win_amd64.whl",
hash =
"sha256:0d06b30a9207b7c3516a9e0102114024755a07045f0c1d2f2a56b1819ac06bcb", size
= 110973074, upload-time = "2025-11-12T15:21:39.958Z" },
- { url =
"https://files.pythonhosted.org/packages/1e/ce/7d251155a783fb2c1bb6837b2b7023c622a2070a0a72726ca1df47e7ea34/torch-2.9.1-cp311-none-macosx_11_0_arm64.whl",
hash =
"sha256:52347912d868653e1528b47cafaf79b285b98be3f4f35d5955389b1b95224475", size
= 74463887, upload-time = "2025-11-12T15:20:36.611Z" },
- { url =
"https://files.pythonhosted.org/packages/0f/27/07c645c7673e73e53ded71705045d6cb5bae94c4b021b03aa8d03eee90ab/torch-2.9.1-cp312-cp312-manylinux_2_28_aarch64.whl",
hash =
"sha256:da5f6f4d7f4940a173e5572791af238cb0b9e21b1aab592bd8b26da4c99f1cd6", size
= 104126592, upload-time = "2025-11-12T15:20:41.62Z" },
- { url =
"https://files.pythonhosted.org/packages/19/17/e377a460603132b00760511299fceba4102bd95db1a0ee788da21298ccff/torch-2.9.1-cp312-cp312-manylinux_2_28_x86_64.whl",
hash =
"sha256:27331cd902fb4322252657f3902adf1c4f6acad9dcad81d8df3ae14c7c4f07c4", size
= 899742281, upload-time = "2025-11-12T15:22:17.602Z" },
- { url =
"https://files.pythonhosted.org/packages/b1/1a/64f5769025db846a82567fa5b7d21dba4558a7234ee631712ee4771c436c/torch-2.9.1-cp312-cp312-win_amd64.whl",
hash =
"sha256:81a285002d7b8cfd3fdf1b98aa8df138d41f1a8334fd9ea37511517cedf43083", size
= 110940568, upload-time = "2025-11-12T15:21:18.689Z" },
- { url =
"https://files.pythonhosted.org/packages/6e/ab/07739fd776618e5882661d04c43f5b5586323e2f6a2d7d84aac20d8f20bd/torch-2.9.1-cp312-none-macosx_11_0_arm64.whl",
hash =
"sha256:c0d25d1d8e531b8343bea0ed811d5d528958f1dcbd37e7245bc686273177ad7e", size
= 74479191, upload-time = "2025-11-12T15:21:25.816Z" },
+ { url =
"https://files.pythonhosted.org/packages/bb/86/245c240d2138c17ed572c943c289056c2721abab70810d772c6bf5495b28/torch-2.9.0-cp310-cp310-manylinux_2_28_aarch64.whl",
hash =
"sha256:030bbfe367379ae6a4ae4042b6c44da25383343b8b3c68abaa9c7231efbaf2dd", size
= 104213554, upload-time = "2025-10-15T15:45:59.798Z" },
+ { url =
"https://files.pythonhosted.org/packages/58/1d/fd1e88ae0948825efcab7dd66d12bec23f05d4d38ed81573c8d453c14c06/torch-2.9.0-cp310-cp310-manylinux_2_28_x86_64.whl",
hash =
"sha256:51cb63902182a78e90886e8068befd8ea102af4b00e420263591a3d70c7d3c6c", size
= 899795167, upload-time = "2025-10-15T15:47:12.695Z" },
+ { url =
"https://files.pythonhosted.org/packages/63/5a/496197b45c14982bef4e079b24c61dc108e3ab0d0cc9718dba9f54f45a46/torch-2.9.0-cp310-cp310-win_amd64.whl",
hash =
"sha256:3f6aad4d2f0ee2248bac25339d74858ff846c3969b27d14ac235821f055af83d", size
= 109310314, upload-time = "2025-10-15T15:46:16.633Z" },
+ { url =
"https://files.pythonhosted.org/packages/58/b0/2b4e647b0fc706e88eb6c253d05511865578f5f67b55fad639bf3272a4a1/torch-2.9.0-cp310-none-macosx_11_0_arm64.whl",
hash =
"sha256:413e1654c9203733138858780e184d9fc59442f0b3b209e16f39354eb893db9b", size
= 74452019, upload-time = "2025-10-15T15:46:04.296Z" },
+ { url =
"https://files.pythonhosted.org/packages/58/fe/334225e6330e672b36aef23d77451fa906ea12881570c08638a91331a212/torch-2.9.0-cp311-cp311-manylinux_2_28_aarch64.whl",
hash =
"sha256:c596708b5105d0b199215acf0c9be7c1db5f1680d88eddadf4b75a299259a677", size
= 104230578, upload-time = "2025-10-15T15:46:08.182Z" },
+ { url =
"https://files.pythonhosted.org/packages/05/cc/49566caaa218872ec9a2912456f470ff92649894a4bc2e5274aa9ef87c4a/torch-2.9.0-cp311-cp311-manylinux_2_28_x86_64.whl",
hash =
"sha256:51de31219c97c51cf4bf2be94d622e3deb5dcc526c6dc00e97c17eaec0fc1d67", size
= 899815990, upload-time = "2025-10-15T15:48:03.336Z" },
+ { url =
"https://files.pythonhosted.org/packages/74/25/e9ab21d5925b642d008f139d4a3c9664fc9ee1faafca22913c080cc4c0a5/torch-2.9.0-cp311-cp311-win_amd64.whl",
hash =
"sha256:dd515c70059afd95f48b8192733764c08ca37a1d19803af6401b5ecad7c8676e", size
= 109313698, upload-time = "2025-10-15T15:46:12.425Z" },
+ { url =
"https://files.pythonhosted.org/packages/b3/b7/205ef3e94de636feffd64b28bb59a0dfac0771221201b9871acf9236f5ca/torch-2.9.0-cp311-none-macosx_11_0_arm64.whl",
hash =
"sha256:614a185e4986326d526a91210c8fc1397e76e8cfafa78baf6296a790e53a9eec", size
= 74463678, upload-time = "2025-10-15T15:46:29.779Z" },
+ { url =
"https://files.pythonhosted.org/packages/d1/d3/3985739f3b8e88675127bf70f82b3a48ae083e39cda56305dbd90398fec0/torch-2.9.0-cp312-cp312-manylinux_2_28_aarch64.whl",
hash =
"sha256:e5f7af1dc4c0a7c4a260c2534f41ddaf209714f7c89145e644c44712fbd6b642", size
= 104107898, upload-time = "2025-10-15T15:46:20.883Z" },
+ { url =
"https://files.pythonhosted.org/packages/a5/4b/f4bb2e6c25d0272f798cd6d7a04ed315da76cec68c602d87040c7847287f/torch-2.9.0-cp312-cp312-manylinux_2_28_x86_64.whl",
hash =
"sha256:01cff95ecd9a212ea2f141db28acccdceb6a4c54f64e6c51091146f5e2a772c6", size
= 899738273, upload-time = "2025-10-15T15:50:04.188Z" },
+ { url =
"https://files.pythonhosted.org/packages/66/11/c1c5ba6691cda6279087c35bd626536e4fd29521fe740abf5008377a9a02/torch-2.9.0-cp312-cp312-win_amd64.whl",
hash =
"sha256:4582b162f541651f0cb184d3e291c05c2f556c7117c64a9873e2ee158d40062b", size
= 109280887, upload-time = "2025-10-15T15:46:26.228Z" },
+ { url =
"https://files.pythonhosted.org/packages/dd/5f/b85bd8c05312d71de9402bf5868d217c38827cfd09d8f8514e5be128a52b/torch-2.9.0-cp312-none-macosx_11_0_arm64.whl",
hash =
"sha256:33f58e9a102a91259af289d50525c30323b5c9ae1d31322b6447c0814da68695", size
= 74478983, upload-time = "2025-10-15T15:46:39.406Z" },
]
[[package]]
@@ -2035,12 +2030,12 @@ wheels = [
[[package]]
name = "triton"
-version = "3.5.1"
+version = "3.5.0"
source = { registry = "https://pypi.org/simple" }
wheels = [
- { url =
"https://files.pythonhosted.org/packages/fd/6e/676ab5019b4dde8b9b7bab71245102fc02778ef3df48218b298686b9ffd6/triton-3.5.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl",
hash =
"sha256:5fc53d849f879911ea13f4a877243afc513187bc7ee92d1f2c0f1ba3169e3c94", size
= 170320692, upload-time = "2025-11-11T17:40:46.074Z" },
- { url =
"https://files.pythonhosted.org/packages/b0/72/ec90c3519eaf168f22cb1757ad412f3a2add4782ad3a92861c9ad135d886/triton-3.5.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl",
hash =
"sha256:61413522a48add32302353fdbaaf92daaaab06f6b5e3229940d21b5207f47579", size
= 170425802, upload-time = "2025-11-11T17:40:53.209Z" },
- { url =
"https://files.pythonhosted.org/packages/f2/50/9a8358d3ef58162c0a415d173cfb45b67de60176e1024f71fbc4d24c0b6d/triton-3.5.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl",
hash =
"sha256:d2c6b915a03888ab931a9fd3e55ba36785e1fe70cbea0b40c6ef93b20fc85232", size
= 170470207, upload-time = "2025-11-11T17:41:00.253Z" },
+ { url =
"https://files.pythonhosted.org/packages/0b/eb/09e31d107a5d00eb281aa7e6635ca463e9bca86515944e399480eadb71f8/triton-3.5.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl",
hash =
"sha256:d5d3b3d480debf24eaa739623c9a42446b0b77f95593d30eb1f64cd2278cc1f0", size
= 170333110, upload-time = "2025-10-13T16:37:49.588Z" },
+ { url =
"https://files.pythonhosted.org/packages/3d/78/949a04391c21956c816523678f0e5fa308eb5b1e7622d88c4e4ef5fceca0/triton-3.5.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl",
hash =
"sha256:f34bfa21c5b3a203c0f0eab28dcc1e49bd1f67d22724e77fb6665a659200a4ec", size
= 170433488, upload-time = "2025-10-13T16:37:57.132Z" },
+ { url =
"https://files.pythonhosted.org/packages/f5/3a/e991574f3102147b642e49637e0281e9bb7c4ba254edb2bab78247c85e01/triton-3.5.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl",
hash =
"sha256:c9e71db82261c4ffa3921cd050cd5faa18322d2d405c30eb56084afaff3b0833", size
= 170476535, upload-time = "2025-10-13T16:38:05.18Z" },
]
[[package]]