Enhance pickle to retrieve state_dict with a given key (#1671)

This commit is contained in:
Dilshod Tadjibaev
2024-02-06 14:17:33 -06:00
committed by GitHub
parent a90fc5ca5a
commit b75e8945bc
6 changed files with 61 additions and 9 deletions

View File

@ -6,3 +6,5 @@ a= torch.tensor([[1,2,3,4], [5,6,7,8]])
o = OrderedDict()
o["test"] = a
torch.save(o, "test.pt")
torch.save({"model_state_dict": o}, "test_with_key.pt")