Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
71aebe4
bump torchvision to v0.23.0 for libtorch 2.8 (torch 0.17)
Chandraveersingh1717 Apr 13, 2026
8b9fb0c
Upgrade Windows CI runners from windows-2019 to windows-2022
dfalbel Apr 13, 2026
d424bc7
Use CUDA 12.8 in CI
dfalbel Apr 13, 2026
d4762dd
Use ubuntu-latest for CUDA lib build, self-hosted for tests
dfalbel Apr 13, 2026
3f80d87
Upgrade macOS runners from macOS-13 to macOS-14
dfalbel Apr 13, 2026
117e0f9
Install cli package before cmake to fix torch install script
dfalbel Apr 13, 2026
5308fea
Load cli package before sourcing torch install script
dfalbel Apr 13, 2026
2ac812a
Create TORCH_HOME directory before running install script
dfalbel Apr 13, 2026
2478408
Cross-compile x86_64 libtorch on macOS-14 ARM runner
dfalbel Apr 13, 2026
309db52
Pass CMAKE_OSX_ARCHITECTURES to TorchVision ExternalProject
dfalbel Apr 13, 2026
a765c54
Install x86_64 Homebrew libs for macOS cross-compilation
dfalbel Apr 13, 2026
d167236
Use CMAKE_OSX_ARCHITECTURES for package name when cross-compiling
dfalbel Apr 13, 2026
ca9277c
Use ubuntu-latest for R-CMD-check Linux job
dfalbel Apr 14, 2026
f13a0fc
Install x86_64 R via rig for macOS cross-compile tests
dfalbel Apr 14, 2026
8d67ea0
Fix rig installation to use Homebrew
dfalbel Apr 14, 2026
79aa42e
Use macOS-15 runner for x86_64 tests to match libtorch deployment target
dfalbel Apr 14, 2026
0da5753
Install x86_64 Homebrew and libs on test runner for macOS
dfalbel Apr 14, 2026
3f95d79
Fix /usr/local permissions before x86_64 Homebrew install
dfalbel Apr 14, 2026
686ba9b
Install x86_64 Homebrew before rig to avoid permission conflicts
dfalbel Apr 14, 2026
f8abc39
Bump dev version to 0.7.0.9000
dfalbel Apr 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 30 additions & 13 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ jobs:
fail-fast: false
matrix:
config:
- {runner: macOS-13, r_version: release, os: macOS}
- {runner: macOS-14, r_version: release, os: macOS, torch_url: 'https://github.com/mlverse/libtorch-mac-m1/releases/download/LibTorch-for-R/libtorch-x86_64-v2.8.0.zip', cmake_args: '-DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_IGNORE_PATH=/opt/homebrew -DCMAKE_PREFIX_PATH=/usr/local'}
- {runner: [self-hosted, m1], r_version: '', os: macOS}
- {runner: windows-2019, r_version: release, os: windows}
- {runner: windows-2022, r_version: release, os: windows}
- {runner: ubuntu-latest, r_version: release, os: ubuntu}
- {runner: [self-hosted, linux], r_version: release, os: ubuntu, cuda: 11.8, cuda_patch: 0}
- {runner: windows-2019, r_version: release, os: windows, cuda: 11.8, cuda_patch: 0}
- {runner: ubuntu-latest, r_version: release, os: ubuntu, cuda: 12.8, cuda_patch: 0}
- {runner: windows-2022, r_version: release, os: windows, cuda: 12.8, cuda_patch: 0}

include:
- config: {os: ubuntu}
Expand All @@ -38,6 +38,7 @@ jobs:
TORCH_TEST: 1
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
CUDA: ${{matrix.config.cuda}}
TORCH_URL: ${{matrix.config.torch_url}}
MAKEFLAGS: '-j8'
DEBIAN_FRONTEND: 'noninteractive'
TZ: 'Etc/UTC'
Expand All @@ -63,7 +64,7 @@ jobs:
cmake-version: '3.31'

- if: ${{matrix.config.cuda != ''}}
uses: Jimver/cuda-toolkit@v0.2.21
uses: Jimver/cuda-toolkit@v0.2.23
id: cuda-toolkit
with:
cuda: '${{matrix.config.cuda}}.${{matrix.config.cuda_patch}}'
Expand All @@ -76,22 +77,28 @@ jobs:

- name: Install dependencies
run: |
Rscript -e "install.packages(c('remotes', 'desc', 'rcmdcheck', 'hms'))"
Rscript -e "install.packages(c('remotes', 'desc', 'rcmdcheck', 'hms', 'cli'))"
Rscript -e "remotes::install_github('mlverse/torchexport', force = TRUE)"

- name: Install x86_64 Homebrew and libraries
if: ${{ contains(matrix.config.cmake_args, 'x86_64') }}
run: |
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
arch -x86_64 /usr/local/bin/brew install libpng jpeg-turbo

- run: |
cd csrc
mkdir build && cd build
cmake ..
cmake .. ${{ matrix.config.cmake_args }}
cmake --build . --target package --config Release --parallel 4

- id: version
shell: bash
run: |
version=$(Rscript -e "cat(as.character(desc::desc_get_version()))")
fname=$(Rscript -e "cat(list.files('csrc/build/', '*.zip'))")
echo "::set-output name=version::$version"
echo "::set-output name=fname::$fname"
echo "version=$version" >> $GITHUB_OUTPUT
echo "fname=$fname" >> $GITHUB_OUTPUT

- uses: svenstaro/upload-release-action@v2
if: github.ref_name == 'main'
Expand All @@ -117,10 +124,10 @@ jobs:
fail-fast: false
matrix:
config:
- {os: mac, runner: macOS-13, r: 'release', artifact: '+cpu+x86_64-Darwin.zip'}
- {os: mac, runner: macOS-15, r: 'release', arch: 'x86_64', artifact: '+cpu+x86_64-Darwin.zip'}
- {os: m1mac, runner: ['self-hosted', 'm1'], artifact: '+cpu+arm64-Darwin.zip'}
- {os: windows, runner: windows-latest, r: 'release', rtools: '42', artifact: '+cpu-win64.zip'}
- {os: ubuntu, runner: ubuntu-20.04, r: 'release', artifact: '+cpu-Linux.zip'}
- {os: ubuntu, runner: ubuntu-latest, r: 'release', artifact: '+cpu-Linux.zip'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -136,14 +143,24 @@ jobs:
if: ${{ !contains(matrix.config.os, 'm1') }}

- uses: r-lib/actions/setup-r@v2
if: ${{ !contains(matrix.config.os, 'm1') }}
if: ${{ !contains(matrix.config.os, 'm1') && matrix.config.arch != 'x86_64' }}
with:
r-version: ${{ matrix.config.r }}
rtools-version: ${{ matrix.config.rtools }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true
windows-path-include-mingw: false

- name: Install x86_64 R and libraries
if: ${{ matrix.config.arch == 'x86_64' }}
run: |
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
arch -x86_64 /usr/local/bin/brew install libpng jpeg-turbo
brew tap r-lib/rig
brew install --cask rig
sudo rig add release --arch x86_64
sudo rig default release

- name: Install dependencies
run: |
Rscript -e "install.packages(c('remotes', 'desc', 'rcmdcheck'))" -e "remotes::install_deps(dependencies = TRUE, INSTALL_opts='--no-multiarch')"
Expand All @@ -154,7 +171,7 @@ jobs:
id: version
run: |
version=$(Rscript -e "cat(as.character(desc::desc_get_version()))")
echo "::set-output name=version::$version"
echo "version=$version" >> $GITHUB_OUTPUT

- uses: actions/download-artifact@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: torchvisionlib
Title: Additional Operators for Image Models
Version: 0.6.0
Version: 0.7.0.9000
Authors@R: c(
person("Daniel", "Falbel", , "daniel@rstudio.com", role = c("aut", "cre")),
person(family = "RStudio", role = c("cph"))
Expand All @@ -19,7 +19,7 @@ LinkingTo:
torch
Imports:
Rcpp,
torch (>= 0.14.0),
torch (>= 0.17.0),
rlang,
glue,
withr
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# torchvisionlib (development version)

# torchvisionlib 0.7.0

- Updates to support LibTorch v2.8


# torchvisionlib 0.5.0

- Updates to support LibTorch v2.0.1
Expand Down
14 changes: 11 additions & 3 deletions csrc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ else()
)
message(STATUS "TORCH_R_VERSION: ${TORCH_R_VERSION}")
SET(TORCH_HOME "${CMAKE_CURRENT_BINARY_DIR}/torch")
file(MAKE_DIRECTORY ${TORCH_HOME})
execute_process(
COMMAND Rscript -e "Sys.setenv(TORCH_HOME='${TORCH_HOME}', TORCH_R_VERSION='${TORCH_R_VERSION}', TORCH_COMMIT_SHA='none');source('${TORCH_INSTALL_SCRIPT}'); install_torch();"
COMMAND Rscript -e "library(cli);Sys.setenv(TORCH_HOME='${TORCH_HOME}', TORCH_R_VERSION='${TORCH_R_VERSION}', TORCH_COMMIT_SHA='none');source('${TORCH_INSTALL_SCRIPT}'); install_torch();"
)
endif()

Expand Down Expand Up @@ -94,6 +95,9 @@ if(WIN32)

elseif(APPLE)
list(APPEND TORCHVISION_CMAKE_ARGS -DCMAKE_FIND_FRAMEWORK:STRING=LAST)
if(CMAKE_OSX_ARCHITECTURES)
list(APPEND TORCHVISION_CMAKE_ARGS -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES})
endif()
endif()

if (WIN32)
Expand All @@ -105,7 +109,7 @@ endif()
message(STATUS "CMAKE_ARGS: ${TORCHVISION_CMAKE_ARGS}")
ExternalProject_Add(TorchVision-project
GIT_REPOSITORY https://github.com/pytorch/vision
GIT_TAG v0.20.1
GIT_TAG v0.23.0
DEPENDS ${TORCHVISION_DEPENDS}
CMAKE_CACHE_ARGS ${TORCHVISION_CMAKE_ARGS}
PREFIX "${CMAKE_CURRENT_BINARY_DIR}/libtorchvision"
Expand Down Expand Up @@ -192,7 +196,11 @@ else()
endif()

if(APPLE)
set(CPACK_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION}+${CMAKE_SYSTEM_PROCESSOR})
if(CMAKE_OSX_ARCHITECTURES)
set(CPACK_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION}+${CMAKE_OSX_ARCHITECTURES})
else()
set(CPACK_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION}+${CMAKE_SYSTEM_PROCESSOR})
endif()
endif()

include(CPack)
Expand Down
20 changes: 0 additions & 20 deletions csrc/patch/kuint16.patch
Original file line number Diff line number Diff line change
@@ -1,23 +1,3 @@
diff --git a/torchvision/csrc/io/image/cpu/decode_png.cpp b/torchvision/csrc/io/image/cpu/decode_png.cpp
index ede14c1e94..a42bd06c35 100644
--- a/torchvision/csrc/io/image/cpu/decode_png.cpp
+++ b/torchvision/csrc/io/image/cpu/decode_png.cpp
@@ -195,9 +195,13 @@ torch::Tensor decode_png(

auto num_pixels_per_row = width * channels;
auto is_16_bits = bit_depth == 16;
+
+ if (is_16_bits) {
+ throw std::runtime_error("16-bit PNG images are not supported.");
+ }
+
auto tensor = torch::empty(
- {int64_t(height), int64_t(width), channels},
- is_16_bits ? at::kUInt16 : torch::kU8);
+ {int64_t(height), int64_t(width), channels}, torch::kU8);
if (is_little_endian()) {
png_set_swap(png_ptr);
}
diff --git a/torchvision/csrc/ops/nms.cpp b/torchvision/csrc/ops/nms.cpp
index 5ecf8812f1..2cbbe93873 100644
--- a/torchvision/csrc/ops/nms.cpp
Expand Down
Loading