Skip to content

Harden legacy converter checkpoint loading#2036

Open
igorsantosgrueiro wants to merge 5 commits into
OpenNMT:masterfrom
igorsantosgrueiro:harden-legacy-converters-20260505
Open

Harden legacy converter checkpoint loading#2036
igorsantosgrueiro wants to merge 5 commits into
OpenNMT:masterfrom
igorsantosgrueiro:harden-legacy-converters-20260505

Conversation

@igorsantosgrueiro
Copy link
Copy Markdown

Summary

  • Load legacy OpenNMT-py and Fairseq converter checkpoints with weights_only=True by default.
  • Add --unsafe_deserialization as an explicit opt-in for trusted legacy checkpoints that still require Python pickle globals.
  • Keep this hardening scoped to the two deprecated converter paths that explicitly opted out of PyTorch's weights-only loader.

This preserves a compatibility path for existing trusted local checkpoints while avoiding unsafe pickle deserialization by default.

Fixes #2034.

Rationale

Some legacy OpenNMT-py/Fairseq checkpoints may include Python objects in addition to tensors and may not load with weights_only=True. Instead of removing that behavior entirely, this PR makes the unsafe behavior explicit and documented at the converter CLI boundary.

Testing

  • Not run locally: upstream checkout and optional converter dependencies are not available in this environment.

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.

Private security contact request

1 participant