Exemplo n.º 1
0
 def Init(self):
     assert self.status_ is SessionStatus.OPEN
     self.status_ = SessionStatus.RUNNING
     if not oneflow._oneflow_internal.IsEnvInited():
         oneflow.env.init()
     _TryCompleteConfigProto(self.config_proto)
     self.resource_ = self.config_proto.resource
     if not oneflow._oneflow_internal.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._oneflow_internal.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._oneflow_internal.LogicalConfigProtoContext(
             str(self.config_proto)
         )
     return self
Exemplo n.º 2
0
 def Init(self):
     assert self.status_ is SessionStatus.OPEN
     self.status_ = SessionStatus.RUNNING
     if not c_api_util.IsEnvInited():
         oneflow.env.init()
     _TryCompleteConfigProto(self.config_proto)
     c_api_util.InitGlobalSession(self.config_proto)
     if not c_api_util.EagerExecutionEnabled():
         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
         c_api_util.StartGlobalSession()
         self.inter_user_job_info_ = c_api_util.GetInterUserJobInfo()
     return self
Exemplo n.º 3
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