8000 weights_only=True allow set as well as dict · Issue #138851 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content
weights_only=True allow set as well as dict #138851
@AngledLuffa

Description

@AngledLuffa

🚀 The feature, motivation and pitch

pytorch.load with weights_only=True allows for loading of lists & dicts

I would expect the builtin set to be just as safe as a dict

Alternatives

Another alternative would be to convert sets to lists before saving, then converting back to a set when loading if the model needs a set internally

Additional context

WeightsUnpickler error: Unsupported global: GLOBAL builtins.set was not an allowed global by default. Please use `torch.serialization.add_safe_globals([set])` to allowlist this global if you trust this class/function.

cc @mruberry @mikaylagawarecki @seemethere @malfet @pytorch/pytorch-dev-infra

Metadata

Metadata

Assignees

Labels

module: serializationIssues related to serialization (e.g., via pickle, or otherwise) of PyTorch objectstriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0