diff --git a/qlib/model/riskmodel/structured.py b/qlib/model/riskmodel/structured.py index d9a2ec130..eb0fec58f 100644 --- a/qlib/model/riskmodel/structured.py +++ b/qlib/model/riskmodel/structured.py @@ -2,7 +2,6 @@ # Licensed under the MIT License. import numpy as np -import pandas as pd from typing import Union from sklearn.decomposition import PCA, FactorAnalysis diff --git a/qlib/workflow/recorder.py b/qlib/workflow/recorder.py index 3d64e268e..67759e590 100644 --- a/qlib/workflow/recorder.py +++ b/qlib/workflow/recorder.py @@ -351,14 +351,16 @@ class MLflowRecorder(Recorder): path = self.client.download_artifacts(self.id, name) with Path(path).open("rb") as f: data = unpickler(f).load() + return data + except Exception as e: + logger.exception(f"Fail to load data '{name}'") + raise LoadObjectError(str(e)) from e + finally: ar = self.client._tracking_client._get_artifact_repo(self.id) if isinstance(ar, AzureBlobArtifactRepository): # for saving disk space # For safety, only remove redundant file for specific ArtifactRepository shutil.rmtree(Path(path).absolute().parent) - return data - except Exception as e: - raise LoadObjectError(str(e)) from e @AsyncCaller.async_dec(ac_attr="async_log") def log_params(self, **kwargs):