Skip to content

Commit 9b0874b

Browse files
committed
Add TODO for setting weights_only to True
https://pytorch.org/docs/stable/generated/torch.load.html
1 parent 1a3e1f5 commit 9b0874b

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

examples/qualcomm/oss_scripts/ssd300_vgg16.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ def SSD300VGG16(pretrained_weight_model):
109109
from model import SSD300
110110

111111
model = SSD300(n_classes=21)
112+
# TODO: If possible, it's better to set weights_only to True
113+
# https://pytorch.org/docs/stable/generated/torch.load.html
112114
checkpoint = torch.load(
113115
pretrained_weight_model, map_location="cpu", weights_only=False
114116
)

examples/qualcomm/scripts/mobilebert_fine_tune.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ 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"

exir/serde/export_serialize.py

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

247249

0 commit comments

Comments
 (0)