@@ -52,7 +52,8 @@ def load_pretrain(exe, prog, path):
52
52
path = get_weights_path (path )
53
53
54
54
if not os .path .exists (path ):
55
- logger .info ('Model path {} does not exists.' .format (path ))
55
+ raise ValueError ("Model pretrain path {} does not "
56
+ "exists." .format (path ))
56
57
57
58
logger .info ('Loading pretrained model from {}...' .format (path ))
58
59
@@ -77,7 +78,8 @@ def load_checkpoint(exe, prog, path):
77
78
path = get_weights_path (path )
78
79
79
80
if not os .path .exists (path ):
80
- logger .info ('Model path {} does not exists.' .format (path ))
81
+ raise ValueError ("Model checkpoint path {} does not "
82
+ "exists." .format (path ))
81
83
82
84
logger .info ('Loading checkpoint from {}...' .format (path ))
83
85
fluid .io .load_persistables (exe , path , prog )
@@ -127,6 +129,9 @@ def load_and_fusebn(exe, prog, path):
127
129
if is_url (path ):
128
130
path = get_weights_path (path )
129
131
132
+ if not os .path .exists (path ):
133
+ raise ValueError ("Model path {} does not exists." .format (path ))
134
+
130
135
def _if_exist (var ):
131
136
b = os .path .exists (os .path .join (path , var .name ))
132
137
if b :
0 commit comments