From 80cab7e617f7deae56fad14ae79df1a91ea4fe51 Mon Sep 17 00:00:00 2001
From: Neta Zmora <neta.zmora@intel.com>
Date: Wed, 13 Nov 2019 18:50:38 +0200
Subject: [PATCH] enable load_checkpoint when chkpt_file has an initial
 component of ~

Prevent exception when loading checkpoints from a home directory
---
 distiller/apputils/checkpoint.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/distiller/apputils/checkpoint.py b/distiller/apputils/checkpoint.py
index 2757cd8..95cda26 100755
--- a/distiller/apputils/checkpoint.py
+++ b/distiller/apputils/checkpoint.py
@@ -182,6 +182,7 @@ def load_checkpoint(model, chkpt_file, optimizer=None,
             # One of the values is missing so we can't perform the comparison
             pass
 
+    chkpt_file = os.path.expanduser(chkpt_file)
     if not os.path.isfile(chkpt_file):
         raise IOError(ENOENT, 'Could not find a checkpoint file at', chkpt_file)
     assert optimizer == None, "argument optimizer is deprecated and must be set to None"
-- 
GitLab