def render(): model = torch.load_model('mymodel') # transformations testset = datasets.CIFAR10('./data-test', download=True, train=False, transform=transform) # testloader for _, data in enumerate(testloader, 0): inputs, labels = data outputs = model(inputs)
def predict(data, code='000001', folder='../dlmodels'): model_file = folder + '/' + 'model_' + code + '.ptm' model = load_model(model_file) model.eval() dataset = torch.FloatTensor(data) x = Variable(dataset) outputs = model(x) outputs = outputs.data.numpy() tmpvalues = np.append(data, outputs) scaler = make_scaler(code=code) tmpvalues = scaler.inverse_transform( np.reshape(tmpvalues, (1, tmpvalues.shape[0]))) tmpvalues = tmpvalues[0] outputs = tmpvalues[feature * timestep:] return format_outputs(outputs)
def load(self, model_name): self.modelF.load_state_dict(load_model(os.path.join('model', model_name)))
def load(self, name): self.model = load_model(name)
def load_model(): return torch.load_model(file2save)
def load(self, name): self.model = load_model(name) self.target_model = load_model(name)