Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PyTorch 2.3 support #9240

Merged
merged 4 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ inputs:
default: '3.8'
torch-version:
required: false
default: '2.2.0'
default: '2.3.0'
cuda-version:
required: false
default: cpu
torchvision-version:
required: false
default: '0.17.0'
default: '0.18.0'
full_install:
required: false
default: true
Expand Down Expand Up @@ -49,7 +49,7 @@ runs:
shell: bash

- name: Install pyg-lib # pyg-lib is currently not available on Windows.
if: ${{ inputs.torch-version != 'nightly' && runner.os != 'Windows' }}
if: ${{ inputs.torch-version != 'nightly' && inputs.torch-version != '2.3.0' && runner.os != 'Windows' }}
run: |
pip uninstall -y pyg-lib
pip install --no-index pyg-lib -f https://data.pyg.org/whl/nightly/torch-${{ inputs.torch-version }}+${{ inputs.cuda-version }}.html
Expand All @@ -74,7 +74,7 @@ runs:
shell: bash

- name: Install extension packages
if: ${{ inputs.full_install == 'true' && inputs.torch-version != 'nightly' && runner.os != 'macOS' }}
if: ${{ inputs.full_install == 'true' && inputs.torch-version != 'nightly' && inputs.torch-version != '2.3.0' && runner.os != 'macOS' }}
run: |
pip install scipy
pip install --no-index --upgrade torch-scatter torch-sparse torch-cluster torch-spline-conv -f https://data.pyg.org/whl/torch-${{ inputs.torch-version }}+${{ inputs.cuda-version }}.html
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/prev_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ jobs:
strategy:
fail-fast: false
matrix:
torch-version: [1.13.0, 2.0.0, 2.1.0]
torch-version: [1.13.0, 2.0.0, 2.1.0, 2.2.0]
include:
- torch-version: 1.13.0
torchvision-version: 0.14.0
- torch-version: 2.0.0
torchvision-version: 0.15.0
- torch-version: 2.1.0
torchvision-version: 0.16.0
- torch-version: 2.2.0
torchvision-version: 0.17.0

steps:
- name: Checkout repository
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Testing PyTorch 2.2
name: Testing PyTorch 2.3

on: # yamllint disable-line rule:truthy
push:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

### Added

- Added support for PyTorch 2.3 ([#9240](https://github.com/pyg-team/pytorch_geometric/pull/9240))
- Added support for `EdgeIndex` in `message_and_aggregate` ([#9131](https://github.com/pyg-team/pytorch_geometric/pull/9131))
- Added `CornellTemporalHyperGraphDataset` ([#9090](https://github.com/pyg-team/pytorch_geometric/pull/9090))
- Added support for cuGraph data loading and `GAT` in single node Papers100m examples ([#8173](https://github.com/pyg-team/pytorch_geometric/pull/8173))
Expand Down
2 changes: 1 addition & 1 deletion test/nn/test_compile_conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_compile_conv(device, Conv):
@withDevice
@onlyLinux
@onlyFullTest
@withPackage('torch==2.3.0')
@withPackage('torch==2.3')
@pytest.mark.parametrize('Conv', [GCNConv, SAGEConv])
def test_compile_conv_edge_index(device, Conv):
import torch._dynamo as dynamo
Expand Down
4 changes: 2 additions & 2 deletions test/test_edge_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -1179,7 +1179,7 @@ def forward(self, x: Tensor, edge_index: EdgeIndex) -> Tensor:


@onlyLinux
@withPackage('torch==2.3.0')
@withPackage('torch==2.3')
def test_compile_basic():
import torch._dynamo as dynamo

Expand Down Expand Up @@ -1210,7 +1210,7 @@ def forward(self, x: Tensor, edge_index: EdgeIndex) -> Tensor:


@onlyLinux
@withPackage('torch==2.3.0')
@withPackage('torch==2.3')
@pytest.mark.skip(reason="Does not work currently")
def test_compile_create_edge_index():
import torch._dynamo as dynamo
Expand Down
4 changes: 3 additions & 1 deletion torch_geometric/datasets/s3dis.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from typing import Callable, List, Optional

import torch
from torch import Tensor

from torch_geometric.data import (
Data,
Expand Down Expand Up @@ -91,7 +92,8 @@ def process(self) -> None:
with open(self.raw_paths[1], 'r') as f:
rooms = f.read().split('\n')[:-1]

xs, ys = [], []
xs: List[Tensor] = []
ys: List[Tensor] = []
for filename in filenames:
h5 = h5py.File(osp.join(self.raw_dir, filename))
xs += torch.from_numpy(h5['data'][:]).unbind(0)
Expand Down
4 changes: 2 additions & 2 deletions torch_geometric/io/tu.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def read_tu_data(
if node_label.dim() == 1:
node_label = node_label.unsqueeze(-1)
node_label = node_label - node_label.min(dim=0)[0]
node_labels = node_label.unbind(dim=-1)
node_labels = list(node_label.unbind(dim=-1))
node_labels = [one_hot(x) for x in node_labels]
if len(node_labels) == 1:
node_label = node_labels[0]
Expand All @@ -56,7 +56,7 @@ def read_tu_data(
if edge_label.dim() == 1:
edge_label = edge_label.unsqueeze(-1)
edge_label = edge_label - edge_label.min(dim=0)[0]
edge_labels = edge_label.unbind(dim=-1)
edge_labels = list(edge_label.unbind(dim=-1))
edge_labels = [one_hot(e) for e in edge_labels]
if len(edge_labels) == 1:
edge_label = edge_labels[0]
Expand Down
Loading