diff --git a/CMakeLists.txt b/CMakeLists.txt index 63dcbd3..14ebe8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") option(DOWNLOAD_DATASETS "Automatically download required datasets at build-time." ON) option(CREATE_SCRIPTMODULES "Automatically create all required scriptmodule files at build-time (requires python3)." OFF) -set(PYTORCH_VERSION "2.6.0") +set(PYTORCH_VERSION "2.8.0") set(PYTORCH_MIN_VERSION "1.12.0") find_package(Torch QUIET PATHS "${CMAKE_SOURCE_DIR}/libtorch") diff --git a/Dockerfile b/Dockerfile index df52f16..12aa7d3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,8 +31,8 @@ RUN curl --silent --show-error --location --output ~/miniconda.sh https://repo.a FROM conda AS conda-installs # Install pytorch for CPU and torchvision. -ARG PYTORCH_VERSION=2.6.0 -ARG TORCHVISION_VERSION=0.18.0 +ARG PYTORCH_VERSION=2.8.0 +ARG TORCHVISION_VERSION=0.23.0 ENV NO_CUDA=1 RUN conda install pytorch==${PYTORCH_VERSION} torchvision==${TORCHVISION_VERSION} cpuonly -y -c pytorch && conda clean -ya diff --git a/README.md b/README.md index 3088351..469dea9 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,12 @@ C++ Implementation of PyTorch Tutorials for Everyone
- +

-| OS (Compiler)\\LibTorch | 2.6.0 | +| OS (Compiler)\\LibTorch | 2.8.0 | | :--------------------- | :--------------------------------------------------------------------------------------------------- | | macOS (clang 15, 16) | [![Status](https://github.com/prabhuomkar/pytorch-cpp/actions/workflows/build_macos.yml/badge.svg?branch=master)](https://github.com/prabhuomkar/pytorch-cpp/actions?query=workflow%3Aci-build-macos) | | Linux (gcc 13, 14) | [![Status](https://github.com/prabhuomkar/pytorch-cpp/actions/workflows/build_ubuntu.yml/badge.svg?branch=master)](https://github.com/prabhuomkar/pytorch-cpp/actions?query=workflow%3Aci-build-ubuntu) | @@ -52,7 +52,7 @@ This repository provides tutorial code in C++ for deep learning researchers to l 1. [C++-17](http://www.cplusplus.com/doc/tutorial/introduction/) compatible compiler 2. [CMake](https://cmake.org/download/) (minimum version 3.28.6) -3. [LibTorch version >= 1.12.0 and <= 2.6.0](https://pytorch.org/cppdocs/installing.html) +3. [LibTorch version >= 1.12.0 and <= 2.8.0](https://pytorch.org/cppdocs/installing.html) 4. [Conda](https://docs.conda.io/projects/conda/en/latest/user-guide/install/download.html) @@ -89,7 +89,7 @@ Some useful options: | Option | Default | Description | | :------------- |:------------|-----:| -| `-D CUDA_V=(11.8\|12.4\|12.6\|none)` | `none` | Download LibTorch for a CUDA version (`none` = download CPU version). | +| `-D CUDA_V=(11.8\|12.4\|12.6\|12.8\|12.9\|none)` | `none` | Download LibTorch for a CUDA version (`none` = download CPU version). | | `-D LIBTORCH_DOWNLOAD_BUILD_TYPE=(Release\|Debug)` | `Release` | Determines which libtorch build type version to download (only relevant on **Windows**).| | `-D DOWNLOAD_DATASETS=(OFF\|ON)` | `ON` | Download required datasets during build (only if they do not already exist in `pytorch-cpp/data`). | |`-D CREATE_SCRIPTMODULES=(OFF\|ON)` | `OFF` | Create all required scriptmodule files for prelearned models / weights during build. Requires installed python3 with pytorch and torchvision. | diff --git a/cmake/fetch_libtorch.cmake b/cmake/fetch_libtorch.cmake index 4b15c78..763639a 100644 --- a/cmake/fetch_libtorch.cmake +++ b/cmake/fetch_libtorch.cmake @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.28.6 FATAL_ERROR) include(FetchContent) -set(CUDA_V "none" CACHE STRING "Determines libtorch CUDA version to download (11.8, 12.4, 12.6 or none).") +set(CUDA_V "none" CACHE STRING "Determines libtorch CUDA version to download (11.8, 12.4, 12.6, 12.8, 12.9 or none).") if(${CUDA_V} STREQUAL "none") set(LIBTORCH_DEVICE "cpu") @@ -12,8 +12,12 @@ elseif(${CUDA_V} STREQUAL "12.4") set(LIBTORCH_DEVICE "cu124") elseif(${CUDA_V} STREQUAL "12.6") set(LIBTORCH_DEVICE "cu126") +elseif(${CUDA_V} STREQUAL "12.8") + set(LIBTORCH_DEVICE "cu126") +elseif(${CUDA_V} STREQUAL "12.9") + set(LIBTORCH_DEVICE "cu126") else() - message(FATAL_ERROR "Invalid CUDA version specified, must be 11.8, 12.4, 12.6 or none!") + message(FATAL_ERROR "Invalid CUDA version specified, must be 11.8, 12.4, 12.6, 12.8, 12.9 or none!") endif() if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") diff --git a/tutorials/popular/blitz/training_a_classifier/src/main.cpp b/tutorials/popular/blitz/training_a_classifier/src/main.cpp index 8d1bfaa..61c12c9 100644 --- a/tutorials/popular/blitz/training_a_classifier/src/main.cpp +++ b/tutorials/popular/blitz/training_a_classifier/src/main.cpp @@ -69,7 +69,7 @@ int main() { std::cout << "Finished Training\n\n"; std::string PATH = "./cifar_net.pth"; - // torch::save(net, PATH); + torch::save(net, PATH); // Test the network on the test data net = Net();