def build_model(self, local_session=True): if type(self.filename) == list: models = [] for fn in self.filename: models.append(load_model(filename=fn)) return MPIModel(models=models) else: return MPIModel( model=load_model(filename=self.filename, custom_objects=self.custom_objects, weights_file=self.weights))
def build_model(self): if type(self.filename) == list: models = [] for fn in self.filename: models.append(load_model(filename=fn)) return MPIModel(models=models) else: return MPIModel( model=load_model(filename=self.filename, json_str=self.json_str, custom_objects=self.custom_objects, weights_file=self.weights))
def build_model_aux(self): import keras.backend as K with K.tf.device(self.device): if type(self.filename) == list: models = [] self.weights = self.weights.split( ',') if self.weights else [None] * len(self.filename) for fn, w in zip(self.filename, self.weights): models.append(load_model(filename=fn, weights_file=w)) return MPIModel(models=models) else: model = load_model(filename=self.filename, model=self.model, custom_objects=self.custom_objects, weights_file=self.weights) return MPIModel(model=model)
def build_model(self): import keras.backend as K K.set_session( K.tf.Session( config=K.tf.ConfigProto( allow_soft_placement=True, log_device_placement=False, gpu_options=K.tf.GPUOptions( per_process_gpu_memory_fraction=1./self.comm.Get_size()) ) ) ) with K.tf.device(self.device): model = load_model(filename=self.filename, json_str=self.json_str, custom_objects=self.custom_objects, weights_file=self.weights) return model
def build_model(self): import keras.backend as K K.set_session( K.tf.Session(config=K.tf.ConfigProto( allow_soft_placement=True, log_device_placement=False, gpu_options=K.tf.GPUOptions( per_process_gpu_memory_fraction=1. / self.comm.Get_size())))) with K.tf.device(self.device): if type(self.filename) == list: models = [] self.weights = self.weights.split( ',') if self.weights else [None] * len(self.filename) for fn, w in zip(self.filename, self.weights): models.append(load_model(filename=fn, weights_file=w)) return MPIModel(models=models) else: model = load_model(filename=self.filename, json_str=self.json_str, custom_objects=self.custom_objects, weights_file=self.weights) return MPIModel(model=model)
def build_model(self): import keras.backend as K K.set_session( K.tf.Session(config=K.tf.ConfigProto( allow_soft_placement=True, log_device_placement=False, gpu_options=K.tf.GPUOptions( per_process_gpu_memory_fraction=1. / self.comm.Get_size())))) with K.tf.device(self.device): model = load_model(filename=self.filename, json_str=self.json_str, custom_objects=self.custom_objects, weights_file=self.weights) return model
def build_model(self): return load_model(filename=self.filename, json_str=self.json_str, custom_objects=self.custom_objects, weights_file=self.weights)