Ejemplo n.º 1
0
 def _init_runtime(self):
     """ Call _init_runtime under different CUDA_VISIBLE_DEVICES, you'll
         have workers that run on multiGPUs
     """
     if self.idx != 0:
         from tensorpack.models.common import disable_layer_logging
         disable_layer_logging()
     self.predictor = OfflinePredictor(self.config)
     if self.idx == 0:
         with self.predictor.graph.as_default():
             describe_model()
Ejemplo n.º 2
0
 def _init_runtime(self):
     """ Call _init_runtime under different CUDA_VISIBLE_DEVICES, you'll
         have workers that run on multiGPUs
     """
     if self.idx != 0:
         from tensorpack.models.common import disable_layer_logging
         disable_layer_logging()
     self.predictor = OfflinePredictor(self.config)
     if self.idx == 0:
         with self.predictor.graph.as_default():
             describe_model()
Ejemplo n.º 3
0
    def _prepare(self):
        disable_layer_logging()
        self.predictor = OfflinePredictor(self.pred_config)
        with self.predictor.graph.as_default():
            vars_to_update = self._params_to_update()
            self.sess_updater = SessionUpdate(
                self.predictor.session, vars_to_update)
        # TODO setup callback for explore?
        self.predictor.graph.finalize()

        self.weight_lock = threading.Lock()

        # start a thread to wait for notification
        def func():
            self.condvar.acquire()
            while True:
                self.condvar.wait()
                self._trigger_evt()
        self.evt_th = threading.Thread(target=func)
        self.evt_th.daemon = True
        self.evt_th.start()
Ejemplo n.º 4
0
    def _prepare(self):
        disable_layer_logging()
        self.predictor = OfflinePredictor(self.pred_config)
        with self.predictor.graph.as_default():
            vars_to_update = self._params_to_update()
            self.sess_updater = SessionUpdate(
                self.predictor.session, vars_to_update)
        # TODO setup callback for explore?
        self.predictor.graph.finalize()

        self.weight_lock = threading.Lock()

        # start a thread to wait for notification
        def func():
            self.condvar.acquire()
            while True:
                self.condvar.wait()
                self._trigger_evt()
        self.evt_th = threading.Thread(target=func)
        self.evt_th.daemon = True
        self.evt_th.start()