Skip to content

Commit 58ab100

Browse files
authored
Adding a test to check that PT model is saved without issues (aws#283)
* test that model can be pickled without issues
1 parent 64879bd commit 58ab100

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/pytorch/test_simple_write.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,12 @@ def saveall_test_helper(hook=None):
266266
else:
267267
addendum = "jsonloading"
268268
hook._cleanup()
269+
270+
# smdebug hook should not be pickled. Check if model is saved without issues.
271+
# The following two lines will error out if there is an attempt to pickle the hook.
272+
torch.save(model.state_dict(), "/tmp/test_output/test_hook_saveall/model_weights")
273+
torch.save(model, "/tmp/test_output/test_hook_saveall/model")
274+
269275
delete_local_trials(["/tmp/test_output/test_hook_saveall/" + addendum])
270276

271277

0 commit comments

Comments
 (0)