Skip to content

Ensure torch 2.6+ compatibility, fix chain import and removal order in prune_program #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

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