File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 8181 help = "Vocabulary filepath. (default: %(default)s)" )
8282parser .add_argument (
8383 "--init_model_path" ,
84-  default = 'models/params.tar.gz' ,
84+  default = None ,
8585 type = str ,
86-  help = "Model path for initialization. (default: %(default)s)" )
86+  help = "If set None, the training will start from scratch. " 
87+  "Otherwise, the training will resume from the existing model of this path. (default: %(default)s)" 
88+ )
8789args  =  parser .parse_args ()
8890
8991
@@ -124,7 +126,8 @@ def train():
124126 if  args .init_model_path  is  None :
125127 parameters  =  paddle .parameters .create (cost )
126128 else :
127-  assert  os .path .isfile (args .init_model_path ), "Invalid model." 
129+  if  not  os .path .isfile (args .init_model_path ):
130+  raise  IOError ("Invalid model!" )
128131 parameters  =  paddle .parameters .Parameters .from_tar (
129132 gzip .open (args .init_model_path ))
130133 optimizer  =  paddle .optimizer .Adam (
                         You can’t perform that action at this time. 
           
                  
0 commit comments