mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 12:54:11 +08:00
[ez][export] Better error message for schema check in torch.export.load (#156361)
Summary: Fixes https://github.com/pytorch/pytorch/issues/156354 torch.export.load() only supports files generated by torch.export.save() Test Plan: CI Rollback Plan: Differential Revision: D76928725 Pull Request resolved: https://github.com/pytorch/pytorch/pull/156361 Approved by: https://github.com/zhxchen17
This commit is contained in:
committed by
PyTorch MergeBot
parent
3f69e3b3a0
commit
a21806f038
@ -475,7 +475,9 @@ def load(
|
||||
SCHEMA_VERSION, # todo change archive version to schema version
|
||||
)
|
||||
|
||||
assert len(version) == len(SCHEMA_VERSION)
|
||||
assert len(version) == len(SCHEMA_VERSION), (
|
||||
"Version in the saved file has incorrect length, double check if the file is generated by torch.export.save()"
|
||||
)
|
||||
if version[0] != str(SCHEMA_VERSION[0]):
|
||||
raise RuntimeError(
|
||||
f"Serialized version {version} does not match our current "
|
||||
|
Reference in New Issue
Block a user