Skip to content

Commit

Permalink
Bump tch version to 0.15.0 with libtorch 2.2.0 (#1206)
Browse files Browse the repository at this point in the history
  • Loading branch information
laggui authored Jan 31, 2024
1 parent c620176 commit f1d98bc
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 27 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion burn-tch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ burn-tensor = { path = "../burn-tensor", version = "0.12.0" }
half = { workspace = true, features = ["std"] }
libc = "0.2.150"
rand = { workspace = true, features = ["std"] }
tch = { version = "0.14.0" , features = ["download-libtorch"] }
tch = { version = "0.15.0" , features = ["download-libtorch"] }

[dev-dependencies]
burn-autodiff = { path = "../burn-autodiff", version = "0.12.0", default-features = false, features = [
Expand Down
41 changes: 19 additions & 22 deletions burn-tch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The backend supports CPU (multithreaded), [CUDA](https://pytorch.org/docs/stable
[`tch-rs`](https://github.com/LaurentMazare/tch-rs) requires the C++ PyTorch library (LibTorch) to
be available on your system.

By default, the CPU distribution is installed for LibTorch v2.1.0 as required by `tch-rs`.
By default, the CPU distribution is installed for LibTorch v2.2.0 as required by `tch-rs`.

<details>
<summary><strong>CUDA</strong></summary>
Expand All @@ -26,23 +26,20 @@ To install the latest compatible CUDA distribution, set the `TORCH_CUDA_VERSION`
variable before the `tch-rs` dependency is retrieved with `cargo`.

```shell
export TORCH_CUDA_VERSION=cu118
export TORCH_CUDA_VERSION=cu121
```

On Windows:

```powershell
$Env:TORCH_CUDA_VERSION = "cu118"
$Env:TORCH_CUDA_VERSION = "cu121"
```

_Note: `tch-rs` does not offer the option to download the CUDA 12.1 distribution at this time.
Please refer to the [manual instructions](#cuda) instead._

For example, running the validation sample for the first time could be done with the following
commands:

```shell
export TORCH_CUDA_VERSION=cu118
export TORCH_CUDA_VERSION=cu121
cargo run --bin cuda --release
```

Expand Down Expand Up @@ -91,7 +88,7 @@ platform.
First, download the LibTorch CPU distribution.

```shell
wget -O libtorch.zip https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.1.0%2Bcpu.zip
wget -O libtorch.zip https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.2.0%2Bcpu.zip
unzip libtorch.zip
```

Expand All @@ -111,7 +108,7 @@ export LD_LIBRARY_PATH=/absolute/path/to/libtorch/lib:$LD_LIBRARY_PATH
First, download the LibTorch CPU distribution.

```shell
wget -O libtorch.zip https://download.pytorch.org/libtorch/cpu/libtorch-macos-2.1.0.zip
wget -O libtorch.zip https://download.pytorch.org/libtorch/cpu/libtorch-macos-x86_64-2.2.0.zip
unzip libtorch.zip
```

Expand All @@ -131,7 +128,7 @@ export DYLD_LIBRARY_PATH=/absolute/path/to/libtorch/lib:$DYLD_LIBRARY_PATH
First, download the LibTorch CPU distribution.

```powershell
wget https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-2.1.0%2Bcpu.zip -OutFile libtorch.zip
wget https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-2.2.0%2Bcpu.zip -OutFile libtorch.zip
Expand-Archive libtorch.zip
```

Expand All @@ -147,18 +144,18 @@ $Env:Path += ";/absolute/path/to/libtorch/"

#### CUDA

LibTorch 2.1.0 currently includes binary distributions with CUDA 12.1 or 11.8 runtimes. The manual
LibTorch 2.2.0 currently includes binary distributions with CUDA 11.8 or 12.1 runtimes. The manual
installation instructions are detailed below.

**CUDA 12.1**
**CUDA 11.8**

<details open>
<summary><strong>🐧 Linux</strong></summary>

First, download the LibTorch CUDA 12.1 distribution.
First, download the LibTorch CUDA 11.8 distribution.

```shell
wget -O libtorch.zip https://download.pytorch.org/libtorch/cu121/libtorch-cxx11-abi-shared-with-deps-2.1.0%2Bcu121.zip
wget -O libtorch.zip https://download.pytorch.org/libtorch/cu118/libtorch-cxx11-abi-shared-with-deps-2.2.0%2Bcu118.zip
unzip libtorch.zip
```

Expand All @@ -177,10 +174,10 @@ export LD_LIBRARY_PATH=/absolute/path/to/libtorch/lib:$LD_LIBRARY_PATH
<details>
<summary><strong>🪟 Windows</strong></summary>

First, download the LibTorch CUDA 12.1 distribution.
First, download the LibTorch CUDA 11.8 distribution.

```powershell
wget https://download.pytorch.org/libtorch/cu121/libtorch-win-shared-with-deps-2.1.0%2Bcu121.zip -OutFile libtorch.zip
wget https://download.pytorch.org/libtorch/cu118/libtorch-win-shared-with-deps-2.2.0%2Bcu118.zip -OutFile libtorch.zip
Expand-Archive libtorch.zip
```

Expand All @@ -194,15 +191,15 @@ $Env:Path += ";/absolute/path/to/libtorch/"

</details><br>

**CUDA 11.8**
**CUDA 12.1**

<details open>
<summary><strong>🐧 Linux</strong></summary>

First, download the LibTorch CUDA 11.8 distribution.
First, download the LibTorch CUDA 12.1 distribution.

```shell
wget -O libtorch.zip https://download.pytorch.org/libtorch/cu118/libtorch-cxx11-abi-shared-with-deps-2.1.0%2Bcu118.zip
wget -O libtorch.zip https://download.pytorch.org/libtorch/cu121/libtorch-cxx11-abi-shared-with-deps-2.2.0%2Bcu121.zip
unzip libtorch.zip
```

Expand All @@ -221,10 +218,10 @@ export LD_LIBRARY_PATH=/absolute/path/to/libtorch/lib:$LD_LIBRARY_PATH
<details>
<summary><strong>🪟 Windows</strong></summary>

First, download the LibTorch CUDA 11.8 distribution.
First, download the LibTorch CUDA 12.1 distribution.

```powershell
wget https://download.pytorch.org/libtorch/cu118/libtorch-win-shared-with-deps-2.1.0%2Bcu118.zip -OutFile libtorch.zip
wget https://download.pytorch.org/libtorch/cu121/libtorch-win-shared-with-deps-2.2.0%2Bcu121.zip -OutFile libtorch.zip
Expand-Archive libtorch.zip
```

Expand All @@ -246,7 +243,7 @@ is to use a PyTorch installation. This requires a Python installation.
_Note: MPS acceleration is available on MacOS 12.3+._

```shell
pip install torch==2.1.0
pip install torch==2.2.0
export LIBTORCH_USE_PYTORCH=1
export DYLD_LIBRARY_PATH=/path/to/pytorch/lib:$DYLD_LIBRARY_PATH
```
Expand Down

0 comments on commit f1d98bc

Please sign in to comment.