def __init__(self, f): self.f = f file_path = f'/tmp/{STATE_DICT_NAME}' download_file(BUCKET_NAME, STATE_DICT_NAME, file_path) state_dict = torch.load(file_path, map_location=lambda storage, loc: storage) self.model.load_state_dict(state_dict), self.model.eval() os.remove(file_path)
def _download_file(self): logging.info("Downloading Time Series {} data set...".format( self.para.data_set)) url = "https://github.com/laiguokun/multivariate-time-series-data/" url += "blob/master/{}/".format(self.para.data_set) if self.para.data_set == "solar-energy": url += "solar_AL.txt.gz?raw=true" else: url += "{}.txt.gz?raw=true".format(self.para.data_set) self.out_fn = os.path.join(self.DATA_PATH, self.para.data_set + ".txt.gz") download_file(url, self.out_fn)