File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -3377,7 +3377,20 @@ def parse_config(config_file, config_arg_str):
33773377 g_root_submodel .is_recurrent_layer_group = False
33783378 g_current_submodel = g_root_submodel
33793379
3380- execfile (config_file , make_config_environment (config_file , config_args ))
3380+ # for paddle on spark, need support non-file config.
3381+ # you can use parse_config like below:
3382+ #
3383+ # from paddle.trainer.config_parser import parse_config
3384+ # def configs():
3385+ # #your paddle config code, which is same as config file.
3386+ #
3387+ # config = parse_config(configs, "is_predict=1")
3388+ # # then you get config proto object.
3389+ if hasattr (config_file , '__call__' ):
3390+ config_file .func_globals .update (make_config_environment ("" , config_args ))
3391+ config_file ()
3392+ else :
3393+ execfile (config_file , make_config_environment (config_file , config_args ))
33813394 for k , v in settings .iteritems ():
33823395 if v is None :
33833396 continue
You can’t perform that action at this time.
0 commit comments