Beispiel #1
0
 def Init(self):
     assert self.status_ is SessionStatus.OPEN
     self.status_ = SessionStatus.RUNNING
     if not oneflow_api.IsEnvInited():
         oneflow.env.init()
     _TryCompleteConfigProto(self.config_proto)
     self.resource_ = self.config_proto.resource
     if not oneflow_api.EagerExecutionEnabled():
         c_api_util.InitLazyGlobalSession(self.config_proto)
         for job_name, func_desc in self.job_name2function_desc_.items():
             compiler.Compile(self, func_desc, self.config_proto)
             self.existed_module_names_ = set()
         self.job_name2var_name2var_blob_ = dict()
         assert len(self.job_name2function_desc_.items()) > 0
         oneflow_api.StartLazyGlobalSession()
         self.inter_user_job_info_ = c_api_util.GetInterUserJobInfo()
         # Get latest op_attr and job_name after compiler.Compile
         self.UpdateInfo4InterfaceOp()
         if not config_util.api_legacy_model_io_enabled():
             check_point_v2.Init()
     else:
         self.eager_config_proto_ctx_ = oneflow_api.LogicalConfigProtoContext(
             str(self.config_proto))
     return self
Beispiel #2
0
 def launch(self):
     self._check_status(self.SessionStatus.OPEN)
     oneflow_api.StartLazyGlobalSession()
     self.inter_user_job_info_ = c_api_util.GetInterUserJobInfo()
     self._run_load_checkpoint_job()
     self.status_ = self.SessionStatus.RUNNING