From bd099f1802978f08e926809169aefbd1708ed0b7 Mon Sep 17 00:00:00 2001 From: laurent Date: Thu, 30 Jan 2025 15:54:53 +0100 Subject: [PATCH] Update for pytorch 2.6. --- CHANGELOG.md | 4 ++++ Cargo.toml | 4 ++-- README.md | 4 ++-- examples/python-extension/Cargo.toml | 6 +++--- pyo3-tch/Cargo.toml | 6 +++--- torch-sys/Cargo.toml | 2 +- torch-sys/build.rs | 4 ++-- 7 files changed, 17 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a0d9672..a3389271 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased ### Changed +## v0.19.0 +### Changed +- PyTorch v2.6 support + ## v0.18.1 ### Changed - PyTorch v2.5.1 support diff --git a/Cargo.toml b/Cargo.toml index 8a30e4d5..4725529d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tch" -version = "0.18.1" +version = "0.19.0" authors = ["Laurent Mazare "] edition = "2021" build = "build.rs" @@ -22,7 +22,7 @@ libc = "0.2.0" ndarray = "0.16.1" rand = "0.8" thiserror = "1" -torch-sys = { version = "0.18.1", path = "torch-sys" } +torch-sys = { version = "0.19.0", path = "torch-sys" } zip = "0.6" half = "2" safetensors = "0.3.0" diff --git a/README.md b/README.md index 76869647..c4019fca 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ The code generation part for the C api on top of libtorch comes from ## Getting Started -This crate requires the C++ PyTorch library (libtorch) in version *v2.5.1* to be available on +This crate requires the C++ PyTorch library (libtorch) in version *v2.6.0* to be available on your system. You can either: - Use the system-wide libtorch installation (default). @@ -85,7 +85,7 @@ seem to include `libtorch.a` by default so this would have to be compiled manually, e.g. via the following: ```bash -git clone -b v2.5.1 --recurse-submodule https://github.com/pytorch/pytorch.git pytorch-static --depth 1 +git clone -b v2.6.0 --recurse-submodule https://github.com/pytorch/pytorch.git pytorch-static --depth 1 cd pytorch-static USE_CUDA=OFF BUILD_SHARED_LIBS=OFF python setup.py build # export LIBTORCH to point at the build directory in pytorch-static. diff --git a/examples/python-extension/Cargo.toml b/examples/python-extension/Cargo.toml index 523e1edf..426fa7b0 100644 --- a/examples/python-extension/Cargo.toml +++ b/examples/python-extension/Cargo.toml @@ -18,6 +18,6 @@ crate-type = ["cdylib"] [dependencies] pyo3 = { version = "0.21", features = ["extension-module"] } -pyo3-tch = { path = "../../pyo3-tch", version = "0.18.1" } -tch = { path = "../..", features = ["python-extension"], version = "0.18.1" } -torch-sys = { path = "../../torch-sys", features = ["python-extension"], version = "0.18.1" } +pyo3-tch = { path = "../../pyo3-tch", version = "0.19.0" } +tch = { path = "../..", features = ["python-extension"], version = "0.19.0" } +torch-sys = { path = "../../torch-sys", features = ["python-extension"], version = "0.19.0" } diff --git a/pyo3-tch/Cargo.toml b/pyo3-tch/Cargo.toml index e0c4041e..a332fb4b 100644 --- a/pyo3-tch/Cargo.toml +++ b/pyo3-tch/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pyo3-tch" -version = "0.18.1" +version = "0.19.0" authors = ["Laurent Mazare "] edition = "2021" build = "build.rs" @@ -12,6 +12,6 @@ categories = ["science"] license = "MIT/Apache-2.0" [dependencies] -tch = { path = "..", features = ["python-extension"], version = "0.18.1" } -torch-sys = { path = "../torch-sys", features = ["python-extension"], version = "0.18.1" } +tch = { path = "..", features = ["python-extension"], version = "0.19.0" } +torch-sys = { path = "../torch-sys", features = ["python-extension"], version = "0.19.0" } pyo3 = { version = "0.21", features = ["extension-module"] } diff --git a/torch-sys/Cargo.toml b/torch-sys/Cargo.toml index 44fcaed0..21268047 100644 --- a/torch-sys/Cargo.toml +++ b/torch-sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "torch-sys" -version = "0.18.1" +version = "0.19.0" authors = ["Laurent Mazare "] edition = "2021" build = "build.rs" diff --git a/torch-sys/build.rs b/torch-sys/build.rs index c0148505..cd44c584 100644 --- a/torch-sys/build.rs +++ b/torch-sys/build.rs @@ -10,7 +10,7 @@ use anyhow::{Context, Result}; use std::path::{Path, PathBuf}; use std::{env, fs, io}; -const TORCH_VERSION: &str = "2.5.1"; +const TORCH_VERSION: &str = "2.6.0"; const PYTHON_PRINT_PYTORCH_DETAILS: &str = r" import torch from torch.utils import cpp_extension @@ -158,7 +158,7 @@ fn version_check(version: &str) -> Result<()> { return Ok(()); } let version = version.trim(); - // Typical version number is 2.5.1+cpu or 2.5.1+cu121 + // Typical version number is 2.6.0+cpu or 2.6.0+cu121 let version = match version.split_once('+') { None => version, Some((version, _)) => version,