Skip to content

Commit a322f7d

Browse files
drivanovpre-commit-ci[bot]puririshi98
authored
Fixes for various warnings appearing in examples (part 2) (pyg-team#10370)
Follow-up to [PR#10357](pyg-team#10357) to address and resolve the following remaining warning: ``` test/datasets/test_snap_dataset.py::test_ego_facebook_snap_dataset /usr/local/lib/python3.12/dist-packages/torch_geometric/data/in_memory_dataset.py:131: UserWarning: Weights only load failed. Please file an issue to make torch.load(weights_only=True) compatible in your case. Please use torch.serialization.add_safe_globals([torch_geometric.datasets.snap_dataset.EgoData]) to allowlist this global. out = fs.torch_load(path) ``` --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Rishi Puri <riship@nvidia.com>
1 parent 1b6455e commit a322f7d

File tree

5 files changed

+29
-3
lines changed

5 files changed

+29
-3
lines changed

.github/workflows/linting.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ jobs:
4646
run: |
4747
uv pip install mypy
4848
uv pip install -e ".[full,test]"
49+
uv pip install types-requests
4950
5051
- name: Check type hints
5152
if: steps.changed-files-specific.outputs.only_changed != 'true'
5253
run: |
53-
uv run --no-project mypy
54+
uv run --no-project mypy --cache-dir=/dev/null

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
55

66
## [2.7.0] - 2025-MM-DD
77

8+
### Fixed
9+
10+
- Fix `detach()` warnings in example scripts involving tensor conversions. ([#10357](https://github.com/pyg-team/pytorch_geometric/pull/10357))
11+
812
### Added
913

1014
- Added `Polynormer` model and example ([#9908](https://github.com/pyg-team/pytorch_geometric/pull/9908))

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
intersphinx_mapping = {
4343
'python': ('https://docs.python.org/', None),
4444
# 'numpy': ('http://docs.scipy.org/doc/numpy', None),
45-
'pandas': ('http://pandas.pydata.org/pandas-docs/dev', None),
45+
'pandas': ('http://pandas.pydata.org/pandas-docs/stable', None),
4646
'torch': ('https://pytorch.org/docs/main', None),
4747
}
4848

test/datasets/test_snap_dataset.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,27 @@
44
@onlyOnline
55
@onlyFullTest
66
def test_ego_facebook_snap_dataset(get_dataset):
7+
import warnings
8+
9+
import torch
10+
from packaging import version
11+
12+
if version.parse(torch.__version__) >= version.parse("2.2.0"):
13+
try:
14+
from torch.serialization import add_safe_globals
15+
16+
from torch_geometric.datasets.snap_dataset import EgoData
17+
18+
add_safe_globals([EgoData])
19+
except ImportError:
20+
warnings.warn(
21+
"add_safe_globals is expected but not found in "
22+
"torch.serialization.", stacklevel=2)
23+
else:
24+
warnings.warn(
25+
"add_safe_globals is not available in this version "
26+
"of PyTorch; continuing without it.", stacklevel=2)
27+
728
dataset = get_dataset(name='ego-facebook')
829
assert str(dataset) == 'SNAP-ego-facebook(10)'
930
assert len(dataset) == 10

torch_geometric/data/extract.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def extract_tar(
2828
"""
2929
maybe_log(path, log)
3030
with tarfile.open(path, mode) as f:
31-
f.extractall(folder)
31+
f.extractall(folder, filter='data')
3232

3333

3434
def extract_zip(path: str, folder: str, log: bool = True) -> None:

0 commit comments

Comments
 (0)