Skip to content

Commit cd95fd7

Browse files
Update LibTorch to version 2.8 (#1625)
Co-authored-by: Paulo Valente <[email protected]>
1 parent 6dd8b49 commit cd95fd7

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

torchx/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ In order to use `Torchx`, you will need Elixir installed. Then create an Elixir
1010
via the `mix` build tool:
1111

1212
```
13-
$ mix new my_app
13+
mix new my_app
1414
```
1515

1616
Then you can add `Torchx` as dependency in your `mix.exs`:
@@ -33,15 +33,16 @@ Mix.install([
3333

3434
We will automatically download a precompiled version of `LibTorch` that
3535
runs on the CPU. If you want to use another version, you can set `LIBTORCH_VERSION`
36-
to `2.1.0` or later.
36+
to `2.4.0` or later.
3737

3838
If you want torch with CUDA support, please use `LIBTORCH_TARGET` to choose
3939
CUDA versions. The current supported targets are:
4040

4141
- `cpu` default CPU only version
42-
- `cu118` CUDA 11.8 and CPU version (no macOS support)
42+
- `cu118` CUDA 11.8 and CPU version (no macOS support, libtorch `< 2.8.0` only)
4343
- `cu126` CUDA 12.6 and CPU version (no macOS support)
4444
- `cu128` CUDA 12.8 and CPU version (no macOS support)
45+
- `cu129` CUDA 12.9 and CPU version (no macOS support, libtorch `>= 2.8.0` only)
4546

4647
Once downloaded, we will compile `Torchx` bindings. You will need `make`/`nmake`,
4748
`cmake` (3.12+) and a `C++` compiler. If building on Windows, you will need:

torchx/mix.exs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,29 @@ defmodule Torchx.MixProject do
7575

7676
defp libtorch_config() do
7777
target = System.get_env("LIBTORCH_TARGET", "cpu")
78-
version = System.get_env("LIBTORCH_VERSION", "2.7.0")
78+
version = System.get_env("LIBTORCH_VERSION", "2.8.0")
7979
env_dir = System.get_env("LIBTORCH_DIR")
8080

81+
# 2.8.0 is the first version that supports cu129 and drops cu118
82+
# cu118 might still be needed for older hardware, so we're keeping it
83+
# for now.
84+
valid_targets = ["cpu", "cu118", "cu126", "cu128"]
85+
86+
valid_targets =
87+
case Version.parse(version) do
88+
{:ok, parsed} ->
89+
if Version.match?(parsed, "<= 2.7.0") do
90+
valid_targets
91+
else
92+
(valid_targets -- ["cu118"]) ++ ["cu129"]
93+
end
94+
95+
_ ->
96+
valid_targets
97+
end
98+
8199
%{
82-
valid_targets: ["cpu", "cu118", "cu126", "cu128"],
100+
valid_targets: valid_targets,
83101
target: target,
84102
version: version,
85103
base: "libtorch",

0 commit comments

Comments
 (0)