Skip to content

Fix deprecations#1

Closed
zaz wants to merge 4 commits intofix-close-terminalfrom
fix-deprecations
Closed

Fix deprecations#1
zaz wants to merge 4 commits intofix-close-terminalfrom
fix-deprecations

Conversation

@zaz
Copy link
Copy Markdown
Owner

@zaz zaz commented Apr 11, 2026

Checklist

  • My pull request has a clear and explanatory title.
  • My pull request passes the Linting test.
  • I added appropriate unit tests and I made sure the code passes all unit tests. (refer to comment below)
  • My PR follows PEP8 guidelines. (refer to comment below)
  • My code is properly documented, using numpy docs conventions, and I made sure the documentation renders properly.
  • I linked to issues and PRs that are relevant to this PR.

PR series: #303 #305 306

This PR is only for commits 1b244e5..70959fc. It is number 3 in a series of staged PRs, building upon #305 by adding commits 1b244e5..70959fc; if #305 is rejected, the commits in this PR need to be reviewed.

Description

This PR fixes deprecation warnings in preparation for my subsequent PR to unpin torch. It includes commits

  1. A very basic refactoring
  2. Specifies safe_globals for torch.load. This is good practice vs. allowing PyG to fall back to weights_only=False. Currently this provides no security benefit, but it will do in the future if my PyG PR is accepted.
  3. Extend safe_globals list
  4. Fix various other deprecation warnings.

Overall, the 4 commits in this PR should be fairly benign, reduce various warning messages, and make TopoBench more amenable to upgrade beyond torch 2.3.0.

Issue

This is preparation for fixing issue #306

zaz added 4 commits April 11, 2026 18:11
Replace if/elif chain with case statement and string concatenation.
No functional changes.
torch >= 2.6 defaults to weights_only=True, which breaks OGB's
torch.load calls that serialize PyG data classes. Register the
needed classes as safe globals so datasets load without errors.
Guarded with hasattr for compatibility with torch < 2.6.
Prevents PyG's fs.torch_load from falling back to weights_only=False
when loading processed datasets that contain numpy scalars and dtypes.
Includes numpy.dtypes.*DType subclasses for numpy >= 1.25.
torch.tensor(existing_tensor) is deprecated; use .detach().clone().
nx.from_numpy_matrix is removed in NetworkX 3.0; use from_numpy_array.
@zaz zaz closed this Apr 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant