mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-07 04:50:56 +08:00
fixed update bugs
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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}.")
|
||||
|
||||
Reference in New Issue
Block a user