diff --git a/qlib/workflow/online/update.py b/qlib/workflow/online/update.py index 96cbf4d65..e5dbd413e 100644 --- a/qlib/workflow/online/update.py +++ b/qlib/workflow/online/update.py @@ -135,10 +135,9 @@ class PredUpdater(RecordUpdater): # RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU. # https://github.com/pytorch/pytorch/issues/16797 - start_time = get_date_by_shift(self.last_end, 1, freq=self.freq) - if start_time > self.to_date: + if self.last_end >= self.to_date: self.logger.info( - f"The prediction in {self.record.info['id']} are latest ({start_time}). No need to update to {self.to_date}." + f"The prediction in {self.record.info['id']} are latest ({self.last_end}). No need to update to {self.to_date}." ) return diff --git a/qlib/workflow/online/utils.py b/qlib/workflow/online/utils.py index a7478afb7..86763d5d6 100644 --- a/qlib/workflow/online/utils.py +++ b/qlib/workflow/online/utils.py @@ -189,6 +189,12 @@ class OnlineToolR(OnlineTool): cls, kwargs = get_cls_kwargs(task["dataset"], default_module="qlib.data.dataset") if issubclass(cls, TSDatasetH): hist_ref = kwargs.get("step_len", TSDatasetH.DEFAULT_STEP_LEN) - PredUpdater(rec, to_date=to_date, hist_ref=hist_ref).update() + try: + updater = PredUpdater(rec, to_date=to_date, hist_ref=hist_ref) + except OSError: + # skip the recorder without pred + self.logger.warn(f"Can't find `pred.pkl`, skip it.") + continue + updater.update() self.logger.info(f"Finished updating {len(online_models)} online model predictions of {exp_name}.")