Skip to content

Load DISTS and VGG16 weights offline via importlib.resources with weights_only=True#14

Open
yun-cheng wants to merge 2 commits into
dingkeyan93:masterfrom
yun-cheng:use-importlib-resources
Open

Load DISTS and VGG16 weights offline via importlib.resources with weights_only=True#14
yun-cheng wants to merge 2 commits into
dingkeyan93:masterfrom
yun-cheng:use-importlib-resources

Conversation

@yun-cheng

@yun-cheng yun-cheng commented Jul 9, 2026

Copy link
Copy Markdown

This PR updates DISTS_pt.py to use importlib.resources instead of relying on sys.prefix or downloading VGG weights online via torchvision.

Specifically:

  • Bundles vgg16_features.pt into the package data and loads VGG16 features offline using importlib.resources.
  • Loads weights.pt cleanly via importlib.resources across virtual environments and packaging formats.
  • Specifies weights_only=True in torch.load calls for improved security and compatibility with PyTorch 2.4+.

@yun-cheng yun-cheng changed the title Use importlib.resources to load package weights and enable weights_only=True in torch.load Use importlib.resources for offline package weight loading and enable weights_only=True Jul 9, 2026
@yun-cheng yun-cheng changed the title Use importlib.resources for offline package weight loading and enable weights_only=True Load DISTS and VGG16 weights offline via importlib.resources with weights_only=True Jul 9, 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