Skip to content

Commit 097dfe4

Browse files
author
yarden-sony
committed
torch.load weights only due to torch version 2.6
1 parent dda57fb commit 097dfe4

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

tests/pytorch_tests/exporter_tests/test_exporting_qat_models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def get_tmp_filepath(self):
5151
return tempfile.mkstemp('.pt')[1]
5252

5353
def load_exported_model(self, filepath):
54-
return torch.load(filepath)
54+
return torch.load(filepath, weights_only=False)
5555

5656
def infer(self, model, images):
5757
return model(images)
@@ -82,7 +82,7 @@ def export_qat_model(self):
8282
self.final_model(images[0])
8383
_final_model_tmp_filepath = tempfile.mkstemp('.pt')[1]
8484
torch.save(self.final_model, _final_model_tmp_filepath)
85-
self.final_model = torch.load(_final_model_tmp_filepath)
85+
self.final_model = torch.load(_final_model_tmp_filepath, weights_only=False)
8686
self.final_model(images[0])
8787

8888
self.filepath = self.get_tmp_filepath()

tests/pytorch_tests/function_tests/test_fully_quantized_exporter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def test_save_and_load_model(self):
9494
print(f"Float Pytorch .pth Model: {float_model_file}")
9595

9696
model = copy.deepcopy(self.fully_quantized_mbv2)
97-
model.load_state_dict(torch.load(model_file))
97+
model.load_state_dict(torch.load(model_file, weights_only=False))
9898
model.eval()
9999
model(next(self.representative_data_gen()))
100100

0 commit comments

Comments
 (0)