def load_model(self, id):
     """
     Load the pickled version of the model into a 'new' model instance.
     :param id: The model ID is constructed from the timestamp when the model was defined.
     """
     model_params = (self.model_name, self.n_in, self.n_hidden, self.n_out, id)
     root = paths.get_root_output_path(*model_params)
     p = paths.get_model_path(root, *model_params[:-1])
     model_params = pkl.load(open(p, "rb"))
     for i in range(len(self.model_params)):
         self.model_params[i].set_value(np.asarray(model_params[i], dtype=theano.config.floatX), borrow=True)
Ejemplo n.º 2
0
 def load_model(self, id):
     """
     Load the pickled version of the model into a 'new' model instance.
     :param id: The model ID is constructed from the timestamp when the model was defined.
     """
     model_params = (self.model_name, self.n_in, self.n_hidden, self.n_out,
                     id)
     root = paths.get_root_output_path(*model_params)
     p = paths.get_model_path(root, *model_params[:-1])
     model_params = pkl.load(open(p, "rb"))
     for i in range(len(self.model_params)):
         self.model_params[i].set_value(np.asarray(
             model_params[i], dtype=theano.config.floatX),
                                        borrow=True)
Ejemplo n.º 3
0
 def load_model(self, id):
     """
     Load the pickled version of the model into a 'new' model instance.
     :param id: The model ID is constructed from the timestamp when the model was defined.
     """
     model_params = (self.model_name, self.n_in, self.n_hidden, self.n_out, id)
     root = paths.get_root_output_path(*model_params)
     self.root_path = root
     p = paths.get_model_path(root, *model_params[:-1])
     model_params = pkl.load(open(p, "rb"))
     for i in range(len(self.model_params)):
         init_param = self.model_params[i]
         loaded_param = model_params[i]
         if not loaded_param.shape == tuple(init_param.shape.eval()):
             print "Model could not be loaded, since parameters are not aligned."
         self.model_params[i].set_value(np.asarray(model_params[i], dtype=theano.config.floatX), borrow=True)
Ejemplo n.º 4
0
 def load_model(self, id):
     """
     Load the pickled version of the model into a 'new' model instance.
     :param id: The model ID is constructed from the timestamp when the model was defined.
     """
     model_params = (self.model_name, self.n_in, self.n_hidden, self.n_out,
                     id)
     root = paths.get_root_output_path(*model_params)
     self.root_path = root
     p = paths.get_model_path(root, *model_params[:-1])
     model_params = pkl.load(open(p, "rb"))
     for i in range(len(self.model_params)):
         init_param = self.model_params[i]
         loaded_param = model_params[i]
         if not loaded_param.shape == tuple(init_param.shape.eval()):
             print "Model could not be loaded, since parameters are not aligned."
         self.model_params[i].set_value(np.asarray(
             model_params[i], dtype=theano.config.floatX),
                                        borrow=True)