Skip to content

Commit 0afb73d

Browse files
Bump torchfix from 0.1.1 to 0.5.0 (#3220)
Summary: Bumps [torchfix](https://github.com/pytorch-labs/torchfix) from 0.1.1 to 0.5.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/pytorch-labs/torchfix/releases">torchfix's releases</a>.</em></p> <blockquote> <h2>TorchFix 0.5.0</h2> <ul> <li>Added rule TOR203 to replace 'import torchvision.models as models' with 'from torchvision import models'</li> <li>Added rules TOR104 and TOR105 for calling and importing non-public PyTorch functions that have known public aliases</li> <li>Added rules TOR004 and TOR103 for importing removed and deprecated functions (in addition to the existing rules for calling those functions)</li> <li>Fixed loading for deprecated symbols config in zipped deployments</li> <li>Done several smaller bug fixes and refactorings</li> </ul> <h2>TorchFix 0.4.0</h2> <ul> <li>Improvements for the standalone <code>torchfix</code> command: <ul> <li>Added <code>--version</code> flag</li> <li><code>--select</code> flag now accepts specific rules, not just <code>ALL</code></li> <li>Fixed excessive debug output on MacOS</li> </ul> </li> <li>Added PyTorch-internal rule TOR901</li> <li>TorchFix explicitly requires at least Python 3.9 now</li> <li>Small clean-ups and bugfixes</li> </ul> <h2>TorchFix 0.3.0</h2> <ul> <li>Added rule TOR003 about explicitly passing <code>use_reentrant</code> to <code>torch.utils.checkpoint</code></li> <li>Added <code>torch.nn.utils.weight_norm</code> to the list of deprecated functions flagged by TOR101</li> <li>Updated README with TOR0 rules description</li> </ul> <h2>TorchFix 0.2.1: first release for pytorch-labs/torchfix repo</h2> <p>This is the first release for pytorch-labs/torchfix repo, with the only differences from TorchFix 0.2.0 on PyPI are files related to repo maintenance and project metadata.</p> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li>See full diff in <a href="https://github.com/pytorch-labs/torchfix/commits/v0.5.0">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=torchfix&package-manager=pip&previous-version=0.1.1&new-version=0.5.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `dependabot rebase` will rebase this PR - `dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `dependabot merge` will merge this PR after your CI passes on it - `dependabot squash and merge` will squash and merge this PR after your CI passes on it - `dependabot cancel merge` will cancel a previously requested merge and block automerging - `dependabot reopen` will reopen this PR if it is closed - `dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Pull Request resolved: #3220 Reviewed By: kit1980 Differential Revision: D56449277 Pulled By: huydhn fbshipit-source-id: ad3c86d49f86427c91af28063d5347b37b893e87
1 parent 4342cf2 commit 0afb73d

File tree

9 files changed

+17
-8
lines changed

9 files changed

+17
-8
lines changed

backends/arm/test/models/test_mobilenet_v2_arm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
import unittest
1010

1111
import torch
12-
import torchvision.models as models
1312
from executorch.backends.arm.test import common
1413

1514
from executorch.backends.arm.test.tester.arm_tester import ArmTester
1615
from executorch.backends.xnnpack.test.tester.tester import Quantize
16+
from torchvision import models
1717
from torchvision.models.mobilenetv2 import MobileNet_V2_Weights
1818

1919

backends/xnnpack/test/models/inception_v3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
import unittest
88

99
import torch
10-
import torchvision.models as models
1110
from executorch.backends.xnnpack.test.tester import Tester
1211
from executorch.backends.xnnpack.test.tester.tester import Quantize
12+
from torchvision import models
1313

1414

1515
class TestInceptionV3(unittest.TestCase):

backends/xnnpack/test/models/mobilenet_v2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
import unittest
88

99
import torch
10-
import torchvision.models as models
1110
from executorch.backends.xnnpack.test.tester import Tester
1211
from executorch.backends.xnnpack.test.tester.tester import Quantize
12+
from torchvision import models
1313
from torchvision.models.mobilenetv2 import MobileNet_V2_Weights
1414

1515

backends/xnnpack/test/models/mobilenet_v3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
import unittest
88

99
import torch
10-
import torchvision.models as models
1110
from executorch.backends.xnnpack.test.tester import Tester
1211
from executorch.backends.xnnpack.test.tester.tester import Quantize
12+
from torchvision import models
1313

1414

1515
class TestMobileNetV3(unittest.TestCase):

backends/xnnpack/test/models/torchvision_vit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import unittest
88

99
import torch
10-
import torchvision.models as models
1110
from executorch.backends.xnnpack.test.tester import Tester
11+
from torchvision import models
1212

1313

1414
class TestViT(unittest.TestCase):

examples/qualcomm/oss_scripts/ssd300_vgg16.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@ def SSD300VGG16(pretrained_weight_model):
109109
from model import SSD300
110110

111111
model = SSD300(n_classes=21)
112-
checkpoint = torch.load(pretrained_weight_model, map_location="cpu")
112+
# TODO: If possible, it's better to set weights_only to True
113+
# https://pytorch.org/docs/stable/generated/torch.load.html
114+
checkpoint = torch.load(
115+
pretrained_weight_model, map_location="cpu", weights_only=False
116+
)
113117
model.load_state_dict(checkpoint["model"].state_dict())
114118

115119
return model.eval()

examples/qualcomm/scripts/mobilebert_fine_tune.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,16 @@ def get_fine_tuned_mobilebert(artifacts_dir, pretrained_weight, batch_size):
204204
)
205205

206206
model.load_state_dict(
207+
# TODO: If possible, it's better to set weights_only to True
208+
# https://pytorch.org/docs/stable/generated/torch.load.html
207209
torch.load(
208210
(
209211
f"{artifacts_dir}/finetuned_mobilebert_epoch_{epochs}.model"
210212
if pretrained_weight is None
211213
else pretrained_weight
212214
),
213215
map_location=torch.device("cpu"),
216+
weights_only=False,
214217
),
215218
)
216219

exir/serde/export_serialize.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,9 @@ def deserialize_torch_artifact(serialized: bytes):
242242
return {}
243243
buffer = io.BytesIO(serialized)
244244
buffer.seek(0)
245-
return torch.load(buffer)
245+
# TODO: If possible, it's better to set weights_only to True
246+
# https://pytorch.org/docs/stable/generated/torch.load.html
247+
return torch.load(buffer, weights_only=False)
246248

247249

248250
def _sympy_int_to_int(val: sympy.Expr):

requirements-lintrunner.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ flake8-comprehensions==3.12.0
1010
flake8-pyi==23.5.0
1111
mccabe==0.7.0
1212
pycodestyle==2.10.0
13-
torchfix==0.1.1
13+
torchfix==0.5.0
1414

1515
# UFMT
1616
black==24.2.0

0 commit comments

Comments
 (0)