Skip to content

Conversation

Meganton
Copy link

@Meganton Meganton commented May 25, 2025

PyTorch 2.6+ changed the default behaviour of torch.load() to weights_only=True. This blocks loading full model objects by default for security reasons.
Setting weights_only to False will load the entire model, bypassing the new restriction.
Source: https://medium.com/@roscoe.kerby/fixing-the-weights-only-load-failed-error-in-pytorch-9098d0a44a9a

Also adding from itertools import chain, as it is needed to import and run prune_program.

Also when removing redundant lines in prune_program, converting the set to a list did not sort it, meaning it could happen that earlier lines were removed first and then later lines became mis-indexed, leading to wrongly deleted lines, or out of range-errors.

@Meganton Meganton changed the title Add weights_only option to ensure torch 2.6+ compatibility Add weights_only option to ensure torch 2.6+ compatibility and itertools import in prune_program May 26, 2025
@Meganton Meganton changed the title Add weights_only option to ensure torch 2.6+ compatibility and itertools import in prune_program Add weights_only option to ensure torch 2.6+ compatibility and chain import in prune_program May 26, 2025
@Meganton Meganton changed the title Add weights_only option to ensure torch 2.6+ compatibility and chain import in prune_program Ensure torch 2.6+ compatibility, fix chain import and removal order in prune_program May 30, 2025
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