Skip to content

Commit c94aa01

Browse files
authored
Update PyTorch to 1.12.0 (#21)
* Update PyTorch to 1.12.0 * restore windows version to latest * fix cuda version * fix cuda install script * fix ubuntu build script * update packages * try fix cudnn install on windows * try fix cudnn install on windows 2 * try fix cudnn install on windows 3 * try fix cudnn install on windows 4 * try fix cudnn install on windows 5 * try fix cudnn install on windows 6
1 parent 2b3bbdc commit c94aa01

File tree

10 files changed

+685
-630
lines changed

10 files changed

+685
-630
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ${{ matrix.os }}
1414
strategy:
1515
matrix:
16-
os: [macos-latest, ubuntu-latest, windows-2019]
16+
os: [macos-latest, ubuntu-latest, windows-latest]
1717
if: "!contains(github.event.head_commit.message, 'ci skip')"
1818

1919
# Steps represent a sequence of tasks that will be executed as part of the job

.github/workflows/publish-prebuild-test.yml

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,36 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
os: [ubuntu-latest, windows-2019]
17+
os: [ubuntu-latest, windows-latest]
1818
if: "!contains(github.event.head_commit.message, 'publish-prebuild skip')"
1919

2020
# Steps represent a sequence of tasks that will be executed as part of the job
2121
steps:
2222
- name: Checkout
2323
uses: actions/checkout@v2
2424

25-
- name: Install CUDA on windows-2019
26-
if: ${{ matrix.os == 'windows-2019' }}
25+
- name: Install node
26+
uses: actions/setup-node@v1
27+
with:
28+
node-version: '16'
29+
30+
- name: Install Python
31+
uses: actions/setup-python@v2
32+
with:
33+
python-version: '3.10'
34+
35+
- name: Setup Conda to install cudnn on windows-latest
36+
uses: s-weigand/setup-conda@v1
37+
if: ${{ matrix.os == 'windows-latest' }}
38+
with:
39+
activate-conda: false
40+
41+
- name: Install CUDA on windows-latest
42+
if: ${{ matrix.os == 'windows-latest' }}
2743
shell: powershell
2844
env:
29-
cuda: "11.3.0"
30-
cudnn: "8.2.1.32"
45+
cuda: "11.6.2"
46+
cudnn: "8.4.0.27"
3147
run: |
3248
# Install CUDA via a powershell script
3349
.\.github\workflows\scripts\install_cuda_windows.ps1
@@ -43,8 +59,8 @@ jobs:
4359
if: ${{ matrix.os == 'ubuntu-latest' }}
4460
shell: bash
4561
env:
46-
cuda: "11.3.0"
47-
cudnn: "8.2.1.32"
62+
cuda: "11.6.2"
63+
cudnn: "8.4.0.27"
4864
run: |
4965
source ./.github/workflows/scripts/install_cuda_ubuntu.sh
5066
if [[ $? -eq 0 ]]; then
@@ -55,24 +71,14 @@ jobs:
5571
echo "LD_LIBRARY_PATH=${CUDA_PATH}/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
5672
fi
5773
58-
- name: Install node
59-
uses: actions/setup-node@v1
60-
with:
61-
node-version: '16'
62-
63-
- name: Install Python
64-
uses: actions/setup-python@v2
65-
with:
66-
python-version: '3.10'
67-
6874
- name: Install packages
6975
run: yarn upgrade --dev
7076

7177
- name: Prebuild
7278
run: yarn build-prebuild
7379

7480
- name: Check prebuild bundle size
75-
if: ${{ matrix.os == 'windows-2019' }}
81+
if: ${{ matrix.os == 'windows-latest' }}
7682
shell: powershell
7783
run: |
7884
ls prebuilds/@arition

.github/workflows/publish-prebuild.yml

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,36 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
os: [macos-latest, ubuntu-latest, windows-2019]
17+
os: [macos-latest, ubuntu-latest, windows-latest]
1818
if: "!contains(github.event.head_commit.message, 'publish-prebuild skip')"
1919

2020
# Steps represent a sequence of tasks that will be executed as part of the job
2121
steps:
2222
- name: Checkout
2323
uses: actions/checkout@v2
2424

25-
- name: Install CUDA on windows-2019
26-
if: ${{ matrix.os == 'windows-2019' }}
25+
- name: Install node
26+
uses: actions/setup-node@v1
27+
with:
28+
node-version: '16'
29+
30+
- name: Install Python
31+
uses: actions/setup-python@v2
32+
with:
33+
python-version: '3.10'
34+
35+
- name: Setup Conda to install cudnn on windows-latest
36+
uses: s-weigand/setup-conda@v1
37+
if: ${{ matrix.os == 'windows-latest' }}
38+
with:
39+
activate-conda: false
40+
41+
- name: Install CUDA on windows-latest
42+
if: ${{ matrix.os == 'windows-latest' }}
2743
shell: powershell
2844
env:
29-
cuda: "11.3.0"
30-
cudnn: "8.2.1.32"
45+
cuda: "11.6.2"
46+
cudnn: "8.4.0.27"
3147
run: |
3248
# Install CUDA via a powershell script
3349
.\.github\workflows\scripts\install_cuda_windows.ps1
@@ -43,8 +59,8 @@ jobs:
4359
if: ${{ matrix.os == 'ubuntu-latest' }}
4460
shell: bash
4561
env:
46-
cuda: "11.3.0"
47-
cudnn: "8.2.1.32"
62+
cuda: "11.6.2"
63+
cudnn: "8.4.0.27"
4864
run: |
4965
source ./.github/workflows/scripts/install_cuda_ubuntu.sh
5066
if [[ $? -eq 0 ]]; then
@@ -55,24 +71,14 @@ jobs:
5571
echo "LD_LIBRARY_PATH=${CUDA_PATH}/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
5672
fi
5773
58-
- name: Install node
59-
uses: actions/setup-node@v1
60-
with:
61-
node-version: '16'
62-
63-
- name: Install Python
64-
uses: actions/setup-python@v2
65-
with:
66-
python-version: '3.10'
67-
6874
- name: Install packages
6975
run: yarn upgrade --dev
7076

7177
- name: Prebuild
7278
run: yarn build-prebuild
7379

7480
- name: Check prebuild bundle size
75-
if: ${{ matrix.os == 'windows-2019' }}
81+
if: ${{ matrix.os == 'windows-latest' }}
7682
shell: powershell
7783
run: |
7884
ls prebuilds/@arition

.github/workflows/scripts/install_cuda_ubuntu.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,14 @@ echo "CUDA_PACKAGES ${CUDA_PACKAGES}"
111111
PIN_FILENAME="cuda-ubuntu${UBUNTU_VERSION}.pin"
112112
PIN_URL="https://developer.download.nvidia.com/compute/cuda/repos/ubuntu${UBUNTU_VERSION}/x86_64/${PIN_FILENAME}"
113113
APT_KEY_URL="https://developer.download.nvidia.com/compute/cuda/repos/ubuntu${UBUNTU_VERSION}/x86_64/7fa2af80.pub"
114+
APT_KEY_URL2="https://developer.download.nvidia.com/compute/cuda/repos/ubuntu${UBUNTU_VERSION}/x86_64/3bf863cc.pub"
114115
REPO_URL="https://developer.download.nvidia.com/compute/cuda/repos/ubuntu${UBUNTU_VERSION}/x86_64"
115116
CUDNN_REPO_URL="https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu${UBUNTU_VERSION}/x86_64"
116117

117118
echo "PIN_FILENAME ${PIN_FILENAME}"
118119
echo "PIN_URL ${PIN_URL}"
119120
echo "APT_KEY_URL ${APT_KEY_URL}"
121+
echo "APT_KEY_URL2 ${APT_KEY_URL2}"
120122

121123
## -----------------
122124
## Install
@@ -125,6 +127,7 @@ echo "Adding CUDA Repository"
125127
# wget ${PIN_URL}
126128
# sudo mv ${PIN_FILENAME} /etc/apt/preferences.d/cuda-repository-pin-600
127129
sudo apt-key adv --fetch-keys ${APT_KEY_URL}
130+
sudo apt-key adv --fetch-keys ${APT_KEY_URL2}
128131
sudo add-apt-repository "deb ${REPO_URL} /"
129132
sudo add-apt-repository "deb ${CUDNN_REPO_URL} /"
130133
sudo apt-get update

.github/workflows/scripts/install_cuda_windows.ps1

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ $CUDA_KNOWN_URLS = @{
99
"11.0.2" = "https://developer.download.nvidia.com/compute/cuda/11.0.2/network_installers/cuda_11.0.2_win10_network.exe";
1010
"11.1.1" = "https://developer.download.nvidia.com/compute/cuda/11.1.1/network_installers/cuda_11.1.1_win10_network.exe";
1111
"11.3.1" = "https://developer.download.nvidia.com/compute/cuda/11.3.1/network_installers/cuda_11.3.1_win10_network.exe";
12+
"11.6.2" = "https://developer.download.nvidia.com/compute/cuda/11.6.2/network_installers/cuda_11.6.2_windows_network.exe";
1213
}
1314

1415
# cuda_runtime.h is in nvcc <= 10.2, but cudart >= 11.0
@@ -93,10 +94,10 @@ if($CUDA_KNOWN_URLS.containsKey($CUDA_VERSION_FULL)){
9394
} else{
9495
# Guess what the url is given the most recent pattern (at the time of writing, 11)
9596
Write-Output "note: URL for CUDA ${$CUDA_VERSION_FULL} not known, estimating."
96-
$CUDA_REPO_PKG_REMOTE="http://developer.download.nvidia.com/compute/cuda/$($CUDA_VERSION_FULL)/network_installers/cuda_$($CUDA_VERSION_FULL)_win10_network.exe"
97+
$CUDA_REPO_PKG_REMOTE="https://developer.download.nvidia.com/compute/cuda/$($CUDA_VERSION_FULL)/network_installers/cuda_$($CUDA_VERSION_FULL)_windows_network.exe"
9798
}
9899
$TEMP_PATH = [System.IO.Path]::GetTempPath()
99-
$CUDA_REPO_PKG_LOCAL = Join-Path $TEMP_PATH "cuda_$($CUDA_VERSION_FULL)_win10_network.exe"
100+
$CUDA_REPO_PKG_LOCAL = Join-Path $TEMP_PATH "cuda_$($CUDA_VERSION_FULL)_windows_network.exe"
100101

101102

102103
## ------------
@@ -131,23 +132,7 @@ $CUDA_PATH_VX_Y = "CUDA_PATH_V$($CUDA_MAJOR)_$($CUDA_MINOR)"
131132
# Append $CUDA_PATH/bin to path.
132133
# Set CUDA_PATH as an environmental variable
133134

134-
$CUDNN_ZIP_REMOTE = "http://developer.download.nvidia.com/compute/redist/cudnn/v$($CUDNN_MAJOR).$($CUDNN_MINOR).$($CUDNN_PATCH)/cudnn-$($CUDA_MAJOR).$($CUDA_MINOR)-windows-x64-v$($CUDNN_VERSION_FULL).zip"
135-
$CUDNN_ZIP_LOCAL = Join-Path $TEMP_PATH "cudnn.zip"
136-
137-
Write-Output "Downloading CUDNN zip for $($CUDNN_VERSION_FULL) from: $($CUDNN_ZIP_REMOTE)"
138-
Invoke-WebRequest $CUDNN_ZIP_REMOTE -OutFile $CUDNN_ZIP_LOCAL | Out-Null
139-
if(Test-Path -Path $CUDNN_ZIP_LOCAL){
140-
Write-Output "Downloading Complete"
141-
} else {
142-
Write-Output "Error: Failed to download $($CUDNN_ZIP_LOCAL) from $($CUDNN_ZIP_REMOTE)"
143-
exit 1
144-
}
145-
146-
Write-Output "Installing CUDNN"
147-
148-
Expand-Archive -Path $CUDNN_ZIP_LOCAL -DestinationPath $TEMP_PATH
149-
$CUDNN_EXPAND_LOCAL = Join-Path $TEMP_PATH "cuda"
150-
Copy-Item -Path "$($CUDNN_EXPAND_LOCAL)/*" -Destination $CUDA_PATH -Filter *.* -Force -recurse
135+
conda install -y -c conda-forge cudnn=$($CUDNN_VERSION_FULL)
151136

152137
# Set environmental variables in this session
153138
$env:CUDA_PATH = "$($CUDA_PATH)"

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
cmake_minimum_required(VERSION 3.14)
22
project (torch-js)
33

4-
set(PYTORCH_VERSION 1.11.0)
5-
set(PYTORCH_VISION_VERSION 0.12.0)
4+
set(PYTORCH_VERSION 1.12.0)
5+
set(PYTORCH_VISION_VERSION 0.13.0)
66
find_package(CUDA)
77
if(CUDA_FOUND)
88
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/build/libtorch")

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@arition/torch-js",
3-
"version": "0.13.1",
3+
"version": "0.14.0",
44
"main": "dist/index.js",
55
"types": "dist/index.d.ts",
66
"author": "Kittipat Virochsiri, arition, raghavmecheri",

patches/0001-Remove-native-image-support.patch

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
1-
From 0f0fe21cbf5e12214e1e7d9807cac8478714f300 Mon Sep 17 00:00:00 2001
1+
From cb1e7910b785fdb14a6deb52631c9415c49b5089 Mon Sep 17 00:00:00 2001
22
From: arition <[email protected]>
33
Date: Tue, 1 Dec 2020 00:17:44 -0800
44
Subject: [PATCH] Remove native image support
55

66
---
7-
CMakeLists.txt | 14 ++++++++++----
8-
1 file changed, 10 insertions(+), 4 deletions(-)
7+
CMakeLists.txt | 16 ++++++++++------
8+
1 file changed, 10 insertions(+), 6 deletions(-)
99

1010
diff --git a/CMakeLists.txt b/CMakeLists.txt
11-
index 87179c147..404f5d4a7 100644
11+
index 4e222dbfa..404f5d4a7 100644
1212
--- a/CMakeLists.txt
1313
+++ b/CMakeLists.txt
14-
@@ -24,8 +24,6 @@ if (USE_PYTHON)
14+
@@ -24,10 +24,6 @@ if (USE_PYTHON)
1515
endif()
1616

1717
find_package(Torch REQUIRED)
1818
-find_package(PNG REQUIRED)
1919
-find_package(JPEG REQUIRED)
20+
-add_definitions(-DJPEG_FOUND)
21+
-add_definitions(-DPNG_FOUND)
2022

2123
function(CUDA_CONVERT_FLAGS EXISTING_TARGET)
2224
get_property(old_flags TARGET ${EXISTING_TARGET} PROPERTY INTERFACE_COMPILE_OPTIONS)
23-
@@ -37,6 +35,14 @@ function(CUDA_CONVERT_FLAGS EXISTING_TARGET)
25+
@@ -39,6 +35,14 @@ function(CUDA_CONVERT_FLAGS EXISTING_TARGET)
2426
endif()
2527
endfunction()
2628

@@ -35,7 +37,7 @@ index 87179c147..404f5d4a7 100644
3537
if(MSVC)
3638
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4819")
3739
if(WITH_CUDA)
38-
@@ -80,7 +86,7 @@ FOREACH(DIR ${ALLOW_LISTED})
40+
@@ -82,7 +86,7 @@ FOREACH(DIR ${ALLOW_LISTED})
3941
ENDFOREACH()
4042

4143
add_library(${PROJECT_NAME} SHARED ${ALL_SOURCES})
@@ -44,7 +46,7 @@ index 87179c147..404f5d4a7 100644
4446

4547
if (USE_PYTHON)
4648
target_link_libraries(${PROJECT_NAME} PRIVATE Python3::Python)
47-
@@ -90,7 +96,7 @@ set_target_properties(${PROJECT_NAME} PROPERTIES
49+
@@ -92,7 +96,7 @@ set_target_properties(${PROJECT_NAME} PROPERTIES
4850
EXPORT_NAME TorchVision
4951
INSTALL_RPATH ${TORCH_INSTALL_PREFIX}/lib)
5052

@@ -54,5 +56,5 @@ index 87179c147..404f5d4a7 100644
5456
set(TORCHVISION_CMAKECONFIG_INSTALL_DIR "share/cmake/TorchVision" CACHE STRING "install path for TorchVisionConfig.cmake")
5557

5658
--
57-
2.34.1.windows.1
59+
2.37.1.windows.1
5860

tests/scriptmodule.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe('Constructor', () => {
1111
// TODO -- Fine tune error message to remove stacktrace for error thrown on invalid model file
1212
test('Call constructor from invalid model path', () => {
1313
const t = () => new torch.ScriptModule('/resources/no_model.pt');
14-
expect(t).toThrow(/open file failed because of errno 2 on fopen.*/);
14+
expect(t).toThrow(/Unrecognized data format*/);
1515
expect(true).toEqual(true);
1616
});
1717

0 commit comments

Comments
 (0)