🐛 Bug Description
when I run the code below in qlib-main/examples/workflow_by_code.ipynb,it caused MlflowException: Invalid experiment ID: '.ipynb_checkpoints'
###################################
train model
###################################
data_handler_config = {
"start_time": "2008-01-01",
"end_time": "2020-08-01",
"fit_start_time": "2008-01-01",
"fit_end_time": "2014-12-31",
"instruments": market,
}
task = {
"model": {
"class": "LGBModel",
"module_path": "qlib.contrib.model.gbdt",
"kwargs": {
"loss": "mse",
"colsample_bytree": 0.8879,
"learning_rate": 0.0421,
"subsample": 0.8789,
"lambda_l1": 205.6999,
"lambda_l2": 580.9768,
"max_depth": 8,
"num_leaves": 210,
"num_threads": 20,
},
},
"dataset": {
"class": "DatasetH",
"module_path": "qlib.data.dataset",
"kwargs": {
"handler": {
"class": "Alpha158",
"module_path": "qlib.contrib.data.handler",
"kwargs": data_handler_config,
},
"segments": {
"train": ("2008-01-01", "2014-12-31"),
"valid": ("2015-01-01", "2016-12-31"),
"test": ("2017-01-01", "2020-08-01"),
},
},
},
}
model initiaiton
model = init_instance_by_config(task["model"])
dataset = init_instance_by_config(task["dataset"])
start exp to train model
with R.start(experiment_name="train_model"):
R.log_params(**flatten_dict(task))
model.fit(dataset)
R.save_objects(trained_model=model)
rid = R.get_recorder().id
=====================
The whole error message is below:
[2607:MainThread](2022-04-06 17:38:12,377) INFO - qlib.timer - [log.py:113] - Time cost: 18.919s | Loading data Done
[2607:MainThread](2022-04-06 17:38:12,737) INFO - qlib.timer - [log.py:113] - Time cost: 0.147s | DropnaLabel Done
/Users/yzwu/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/qlib/data/dataset/processor.py:310: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
df[cols] = df[cols].groupby("datetime").apply(self.zscore_func)
[2607:MainThread](2022-04-06 17:38:14,387) INFO - qlib.timer - [log.py:113] - Time cost: 1.650s | CSZScoreNorm Done
[2607:MainThread](2022-04-06 17:38:14,387) INFO - qlib.timer - [log.py:113] - Time cost: 2.010s | fit & process data Done
[2607:MainThread](2022-04-06 17:38:14,388) INFO - qlib.timer - [log.py:113] - Time cost: 20.930s | Init data Done
[2607:MainThread](2022-04-06 17:38:14,399) INFO - qlib.workflow - [expm.py:315] - <mlflow.tracking.client.MlflowClient object at 0x2859099a0>
[2607:MainThread](2022-04-06 17:38:14,402) WARNING - qlib.workflow - [expm.py:195] - No valid experiment found. Create a new experiment with name train_model.
MlflowException Traceback (most recent call last)
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/qlib/workflow/expm.py:391, in MLflowExpManager._get_exp(self, experiment_id, experiment_name)
390 try:
--> 391 exp = self.client.get_experiment_by_name(experiment_name)
392 if exp is None or exp.lifecycle_stage.upper() == "DELETED":
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/mlflow/tracking/client.py:462, in MlflowClient.get_experiment_by_name(self, name)
432 """
433 Retrieve an experiment by experiment name from the backend store
434
(...)
460 Lifecycle_stage: active
461 """
--> 462 return self._tracking_client.get_experiment_by_name(name)
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/mlflow/tracking/_tracking_service/client.py:167, in TrackingServiceClient.get_experiment_by_name(self, name)
163 """
164 :param name: The experiment name.
165 :return: :py:class:mlflow.entities.Experiment
166 """
--> 167 return self.store.get_experiment_by_name(name)
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/mlflow/store/tracking/abstract_store.py:76, in AbstractStore.get_experiment_by_name(self, experiment_name)
67 """
68 Fetch the experiment by name from the backend store.
69 This is a base implementation using list_experiments, derived classes may have
(...)
74 :return: A single :py:class:mlflow.entities.Experiment object if it exists.
75 """
---> 76 for experiment in self.list_experiments(ViewType.ALL):
77 if experiment.name == experiment_name:
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/mlflow/store/tracking/file_store.py:261, in FileStore.list_experiments(self, view_type, max_results, page_token)
259 try:
260 # trap and warn known issues, will raise unexpected exceptions to caller
--> 261 experiment = self._get_experiment(exp_id, view_type)
262 if experiment:
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/mlflow/store/tracking/file_store.py:337, in FileStore._get_experiment(self, experiment_id, view_type)
336 self._check_root_dir()
--> 337 _validate_experiment_id(experiment_id)
338 experiment_dir = self._get_experiment_path(experiment_id, view_type)
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/mlflow/utils/validation.py:267, in _validate_experiment_id(exp_id)
266 if exp_id is not None and _EXPERIMENT_ID_REGEX.match(exp_id) is None:
--> 267 raise MlflowException(
268 "Invalid experiment ID: '%s'" % exp_id, error_code=INVALID_PARAMETER_VALUE
269 )
MlflowException: Invalid experiment ID: '.ipynb_checkpoints'
The above exception was the direct cause of the following exception:
ValueError Traceback (most recent call last)
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/qlib/workflow/expm.py:189, in ExpManager._get_or_create_exp(self, experiment_id, experiment_name)
187 try:
188 return (
--> 189 self._get_exp(experiment_id=experiment_id, experiment_name=experiment_name),
190 False,
191 )
192 except ValueError:
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/qlib/workflow/expm.py:397, in MLflowExpManager._get_exp(self, experiment_id, experiment_name)
396 except MlflowException as e:
--> 397 raise ValueError(
398 "No valid experiment has been found, please make sure the input experiment name is correct."
399 ) from e
ValueError: No valid experiment has been found, please make sure the input experiment name is correct.
During handling of the above exception, another exception occurred:
MlflowException Traceback (most recent call last)
Input In [6], in <cell line: 51>()
48 dataset = init_instance_by_config(task["dataset"])
50 # start exp to train model
---> 51 with R.start(experiment_name="train_model"):
52 R.log_params(**flatten_dict(task))
53 model.fit(dataset)
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/contextlib.py:113, in _GeneratorContextManager.enter(self)
111 del self.args, self.kwds, self.func
112 try:
--> 113 return next(self.gen)
114 except StopIteration:
115 raise RuntimeError("generator didn't yield") from None
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/qlib/workflow/init.py:69, in QlibRecorder.start(self, experiment_id, experiment_name, recorder_id, recorder_name, uri, resume)
25 @contextmanager
26 def start(
27 self,
(...)
34 resume: bool = False,
35 ):
36 """
37 Method to start an experiment. This method can only be called within a Python's with statement. Here is the example code:
38
(...)
67 whether to resume the specific recorder with given name under the given experiment.
68 """
---> 69 run = self.start_exp(
70 experiment_id=experiment_id,
71 experiment_name=experiment_name,
72 recorder_id=recorder_id,
73 recorder_name=recorder_name,
74 uri=uri,
75 resume=resume,
76 )
77 try:
78 yield run
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/qlib/workflow/init.py:125, in QlibRecorder.start_exp(self, experiment_id, experiment_name, recorder_id, recorder_name, uri, resume)
84 def start_exp(
85 self,
86 *,
(...)
92 resume=False,
93 ):
94 """
95 Lower level method for starting an experiment. When use this method, one should end the experiment manually
96 and the status of the recorder may not be handled properly. Here is the example code:
(...)
123 An experiment instance being started.
124 """
--> 125 return self.exp_manager.start_exp(
126 experiment_id=experiment_id,
127 experiment_name=experiment_name,
128 recorder_id=recorder_id,
129 recorder_name=recorder_name,
130 uri=uri,
131 resume=resume,
132 )
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/qlib/workflow/expm.py:339, in MLflowExpManager.start_exp(self, experiment_id, experiment_name, recorder_id, recorder_name, uri, resume)
337 if experiment_name is None:
338 experiment_name = self._default_exp_name
--> 339 experiment, _ = self._get_or_create_exp(experiment_id=experiment_id, experiment_name=experiment_name)
340 # Set up active experiment
341 self.active_experiment = experiment
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/qlib/workflow/expm.py:202, in ExpManager._get_or_create_exp(self, experiment_id, experiment_name)
200 if pr.scheme == "file":
201 with FileLock(os.path.join(pr.netloc, pr.path, "filelock")): # pylint: disable=E0110
--> 202 return self.create_exp(experiment_name), True
203 # NOTE: for other schemes like http, we double check to avoid create exp conflicts
204 try:
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/qlib/workflow/expm.py:362, in MLflowExpManager.create_exp(self, experiment_name)
360 if e.error_code == ErrorCode.Name(RESOURCE_ALREADY_EXISTS):
361 raise ExpAlreadyExistError() from e
--> 362 raise e
364 experiment = MLflowExperiment(experiment_id, experiment_name, self.uri)
365 experiment._default_name = self._default_exp_name
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/qlib/workflow/expm.py:358, in MLflowExpManager.create_exp(self, experiment_name)
356 # init experiment
357 try:
--> 358 experiment_id = self.client.create_experiment(experiment_name)
359 except MlflowException as e:
360 if e.error_code == ErrorCode.Name(RESOURCE_ALREADY_EXISTS):
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/mlflow/tracking/client.py:507, in MlflowClient.create_experiment(self, name, artifact_location, tags)
464 def create_experiment(
465 self,
466 name: str,
467 artifact_location: Optional[str] = None,
468 tags: Optional[Dict[str, Any]] = None,
469 ) -> str:
470 """Create an experiment.
471
472 :param name: The experiment name. Must be unique.
(...)
505 Lifecycle_stage: active
506 """
--> 507 return self._tracking_client.create_experiment(name, artifact_location, tags)
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/mlflow/tracking/_tracking_service/client.py:182, in TrackingServiceClient.create_experiment(self, name, artifact_location, tags)
179 _validate_experiment_name(name)
180 _validate_experiment_artifact_location(artifact_location)
--> 182 return self.store.create_experiment(
183 name=name,
184 artifact_location=artifact_location,
185 tags=[ExperimentTag(key, value) for (key, value) in tags.items()] if tags else [],
186 )
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/mlflow/store/tracking/file_store.py:321, in FileStore.create_experiment(self, name, artifact_location, tags)
319 def create_experiment(self, name, artifact_location=None, tags=None):
320 self._check_root_dir()
--> 321 self._validate_experiment_name(name)
322 # Get all existing experiments and find the one with largest numerical ID.
323 # len(list_all(..)) would not work when experiments are deleted.
324 experiments_ids = [
325 int(e.experiment_id)
326 for e in self.list_experiments(ViewType.ALL)
327 if e.experiment_id.isdigit()
328 ]
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/mlflow/store/tracking/file_store.py:303, in FileStore._validate_experiment_name(self, name)
299 if name is None or name == "":
300 raise MlflowException(
301 "Invalid experiment name '%s'" % name, databricks_pb2.INVALID_PARAMETER_VALUE
302 )
--> 303 experiment = self.get_experiment_by_name(name)
304 if experiment is not None:
305 if experiment.lifecycle_stage == LifecycleStage.DELETED:
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/mlflow/store/tracking/abstract_store.py:76, in AbstractStore.get_experiment_by_name(self, experiment_name)
66 def get_experiment_by_name(self, experiment_name):
67 """
68 Fetch the experiment by name from the backend store.
69 This is a base implementation using list_experiments, derived classes may have
(...)
74 :return: A single :py:class:mlflow.entities.Experiment object if it exists.
75 """
---> 76 for experiment in self.list_experiments(ViewType.ALL):
77 if experiment.name == experiment_name:
78 return experiment
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/mlflow/store/tracking/file_store.py:261, in FileStore.list_experiments(self, view_type, max_results, page_token)
258 for exp_id in rsl:
259 try:
260 # trap and warn known issues, will raise unexpected exceptions to caller
--> 261 experiment = self._get_experiment(exp_id, view_type)
262 if experiment:
263 experiments.append(experiment)
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/mlflow/store/tracking/file_store.py:337, in FileStore._get_experiment(self, experiment_id, view_type)
335 def _get_experiment(self, experiment_id, view_type=ViewType.ALL):
336 self._check_root_dir()
--> 337 _validate_experiment_id(experiment_id)
338 experiment_dir = self._get_experiment_path(experiment_id, view_type)
339 if experiment_dir is None:
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/mlflow/utils/validation.py:267, in _validate_experiment_id(exp_id)
265 """Check that experiment_idis a valid string or None, raise an exception if it isn't."""
266 if exp_id is not None and _EXPERIMENT_ID_REGEX.match(exp_id) is None:
--> 267 raise MlflowException(
268 "Invalid experiment ID: '%s'" % exp_id, error_code=INVALID_PARAMETER_VALUE
269 )
MlflowException: Invalid experiment ID: '.ipynb_checkpoints'
To Reproduce
Steps to reproduce the behavior:
- just rerun the code in my envirment
Expected Behavior
Screenshot
Environment
Note: User could run cd scripts && python collect_info.py all under project directory to get system information
and paste them here directly.
Darwin
arm64
macOS-12.2.1-arm64-arm-64bit
Darwin Kernel Version 21.3.0: Wed Jan 5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_ARM64_T6000
Python version: 3.8.11 (default, Jul 29 2021, 14:57:32) [Clang 12.0.0 ]
Qlib version: 0.8.4.99
numpy==1.22.3
pandas==1.4.2
scipy==1.8.0
requests==2.25.1
sacred==0.8.2
python-socketio==5.5.2
redis==4.2.2
python-redis-lock==3.7.0
schedule==1.1.0
cvxpy==1.1.18
hyperopt==0.1.2
fire==0.4.0
statsmodels==0.13.2
xlrd==2.0.1
plotly==5.6.0
matplotlib==3.5.1
tables==3.7.0
pyyaml==6.0
mlflow==1.24.0
tqdm==4.61.2
loguru==0.6.0
lightgbm==3.3.2
tornado==6.1
joblib==1.1.0
fire==0.4.0
ruamel.yaml==0.17.21
Additional Notes
I installed qlib from source, and my conda env is the version for arm64
🐛 Bug Description
when I run the code below in qlib-main/examples/workflow_by_code.ipynb,it caused MlflowException: Invalid experiment ID: '.ipynb_checkpoints'
###################################
train model
###################################
data_handler_config = {
"start_time": "2008-01-01",
"end_time": "2020-08-01",
"fit_start_time": "2008-01-01",
"fit_end_time": "2014-12-31",
"instruments": market,
}
task = {
"model": {
"class": "LGBModel",
"module_path": "qlib.contrib.model.gbdt",
"kwargs": {
"loss": "mse",
"colsample_bytree": 0.8879,
"learning_rate": 0.0421,
"subsample": 0.8789,
"lambda_l1": 205.6999,
"lambda_l2": 580.9768,
"max_depth": 8,
"num_leaves": 210,
"num_threads": 20,
},
},
"dataset": {
"class": "DatasetH",
"module_path": "qlib.data.dataset",
"kwargs": {
"handler": {
"class": "Alpha158",
"module_path": "qlib.contrib.data.handler",
"kwargs": data_handler_config,
},
"segments": {
"train": ("2008-01-01", "2014-12-31"),
"valid": ("2015-01-01", "2016-12-31"),
"test": ("2017-01-01", "2020-08-01"),
},
},
},
}
model initiaiton
model = init_instance_by_config(task["model"])
dataset = init_instance_by_config(task["dataset"])
start exp to train model
with R.start(experiment_name="train_model"):
R.log_params(**flatten_dict(task))
model.fit(dataset)
R.save_objects(trained_model=model)
rid = R.get_recorder().id
=====================
The whole error message is below:
[2607:MainThread](2022-04-06 17:38:12,377) INFO - qlib.timer - [log.py:113] - Time cost: 18.919s | Loading data Done
[2607:MainThread](2022-04-06 17:38:12,737) INFO - qlib.timer - [log.py:113] - Time cost: 0.147s | DropnaLabel Done
/Users/yzwu/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/qlib/data/dataset/processor.py:310: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
df[cols] = df[cols].groupby("datetime").apply(self.zscore_func)
[2607:MainThread](2022-04-06 17:38:14,387) INFO - qlib.timer - [log.py:113] - Time cost: 1.650s | CSZScoreNorm Done
[2607:MainThread](2022-04-06 17:38:14,387) INFO - qlib.timer - [log.py:113] - Time cost: 2.010s | fit & process data Done
[2607:MainThread](2022-04-06 17:38:14,388) INFO - qlib.timer - [log.py:113] - Time cost: 20.930s | Init data Done
[2607:MainThread](2022-04-06 17:38:14,399) INFO - qlib.workflow - [expm.py:315] - <mlflow.tracking.client.MlflowClient object at 0x2859099a0>
[2607:MainThread](2022-04-06 17:38:14,402) WARNING - qlib.workflow - [expm.py:195] - No valid experiment found. Create a new experiment with name train_model.
MlflowException Traceback (most recent call last)
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/qlib/workflow/expm.py:391, in MLflowExpManager._get_exp(self, experiment_id, experiment_name)
390 try:
--> 391 exp = self.client.get_experiment_by_name(experiment_name)
392 if exp is None or exp.lifecycle_stage.upper() == "DELETED":
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/mlflow/tracking/client.py:462, in MlflowClient.get_experiment_by_name(self, name)
432 """
433 Retrieve an experiment by experiment name from the backend store
434
(...)
460 Lifecycle_stage: active
461 """
--> 462 return self._tracking_client.get_experiment_by_name(name)
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/mlflow/tracking/_tracking_service/client.py:167, in TrackingServiceClient.get_experiment_by_name(self, name)
163 """
164 :param name: The experiment name.
165 :return: :py:class:
mlflow.entities.Experiment166 """
--> 167 return self.store.get_experiment_by_name(name)
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/mlflow/store/tracking/abstract_store.py:76, in AbstractStore.get_experiment_by_name(self, experiment_name)
67 """
68 Fetch the experiment by name from the backend store.
69 This is a base implementation using
list_experiments, derived classes may have(...)
74 :return: A single :py:class:
mlflow.entities.Experimentobject if it exists.75 """
---> 76 for experiment in self.list_experiments(ViewType.ALL):
77 if experiment.name == experiment_name:
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/mlflow/store/tracking/file_store.py:261, in FileStore.list_experiments(self, view_type, max_results, page_token)
259 try:
260 # trap and warn known issues, will raise unexpected exceptions to caller
--> 261 experiment = self._get_experiment(exp_id, view_type)
262 if experiment:
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/mlflow/store/tracking/file_store.py:337, in FileStore._get_experiment(self, experiment_id, view_type)
336 self._check_root_dir()
--> 337 _validate_experiment_id(experiment_id)
338 experiment_dir = self._get_experiment_path(experiment_id, view_type)
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/mlflow/utils/validation.py:267, in _validate_experiment_id(exp_id)
266 if exp_id is not None and _EXPERIMENT_ID_REGEX.match(exp_id) is None:
--> 267 raise MlflowException(
268 "Invalid experiment ID: '%s'" % exp_id, error_code=INVALID_PARAMETER_VALUE
269 )
MlflowException: Invalid experiment ID: '.ipynb_checkpoints'
The above exception was the direct cause of the following exception:
ValueError Traceback (most recent call last)
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/qlib/workflow/expm.py:189, in ExpManager._get_or_create_exp(self, experiment_id, experiment_name)
187 try:
188 return (
--> 189 self._get_exp(experiment_id=experiment_id, experiment_name=experiment_name),
190 False,
191 )
192 except ValueError:
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/qlib/workflow/expm.py:397, in MLflowExpManager._get_exp(self, experiment_id, experiment_name)
396 except MlflowException as e:
--> 397 raise ValueError(
398 "No valid experiment has been found, please make sure the input experiment name is correct."
399 ) from e
ValueError: No valid experiment has been found, please make sure the input experiment name is correct.
During handling of the above exception, another exception occurred:
MlflowException Traceback (most recent call last)
Input In [6], in <cell line: 51>()
48 dataset = init_instance_by_config(task["dataset"])
50 # start exp to train model
---> 51 with R.start(experiment_name="train_model"):
52 R.log_params(**flatten_dict(task))
53 model.fit(dataset)
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/contextlib.py:113, in _GeneratorContextManager.enter(self)
111 del self.args, self.kwds, self.func
112 try:
--> 113 return next(self.gen)
114 except StopIteration:
115 raise RuntimeError("generator didn't yield") from None
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/qlib/workflow/init.py:69, in QlibRecorder.start(self, experiment_id, experiment_name, recorder_id, recorder_name, uri, resume)
25 @contextmanager
26 def start(
27 self,
(...)
34 resume: bool = False,
35 ):
36 """
37 Method to start an experiment. This method can only be called within a Python's
withstatement. Here is the example code:38
(...)
67 whether to resume the specific recorder with given name under the given experiment.
68 """
---> 69 run = self.start_exp(
70 experiment_id=experiment_id,
71 experiment_name=experiment_name,
72 recorder_id=recorder_id,
73 recorder_name=recorder_name,
74 uri=uri,
75 resume=resume,
76 )
77 try:
78 yield run
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/qlib/workflow/init.py:125, in QlibRecorder.start_exp(self, experiment_id, experiment_name, recorder_id, recorder_name, uri, resume)
84 def start_exp(
85 self,
86 *,
(...)
92 resume=False,
93 ):
94 """
95 Lower level method for starting an experiment. When use this method, one should end the experiment manually
96 and the status of the recorder may not be handled properly. Here is the example code:
(...)
123 An experiment instance being started.
124 """
--> 125 return self.exp_manager.start_exp(
126 experiment_id=experiment_id,
127 experiment_name=experiment_name,
128 recorder_id=recorder_id,
129 recorder_name=recorder_name,
130 uri=uri,
131 resume=resume,
132 )
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/qlib/workflow/expm.py:339, in MLflowExpManager.start_exp(self, experiment_id, experiment_name, recorder_id, recorder_name, uri, resume)
337 if experiment_name is None:
338 experiment_name = self._default_exp_name
--> 339 experiment, _ = self._get_or_create_exp(experiment_id=experiment_id, experiment_name=experiment_name)
340 # Set up active experiment
341 self.active_experiment = experiment
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/qlib/workflow/expm.py:202, in ExpManager._get_or_create_exp(self, experiment_id, experiment_name)
200 if pr.scheme == "file":
201 with FileLock(os.path.join(pr.netloc, pr.path, "filelock")): # pylint: disable=E0110
--> 202 return self.create_exp(experiment_name), True
203 # NOTE: for other schemes like http, we double check to avoid create exp conflicts
204 try:
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/qlib/workflow/expm.py:362, in MLflowExpManager.create_exp(self, experiment_name)
360 if e.error_code == ErrorCode.Name(RESOURCE_ALREADY_EXISTS):
361 raise ExpAlreadyExistError() from e
--> 362 raise e
364 experiment = MLflowExperiment(experiment_id, experiment_name, self.uri)
365 experiment._default_name = self._default_exp_name
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/qlib/workflow/expm.py:358, in MLflowExpManager.create_exp(self, experiment_name)
356 # init experiment
357 try:
--> 358 experiment_id = self.client.create_experiment(experiment_name)
359 except MlflowException as e:
360 if e.error_code == ErrorCode.Name(RESOURCE_ALREADY_EXISTS):
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/mlflow/tracking/client.py:507, in MlflowClient.create_experiment(self, name, artifact_location, tags)
464 def create_experiment(
465 self,
466 name: str,
467 artifact_location: Optional[str] = None,
468 tags: Optional[Dict[str, Any]] = None,
469 ) -> str:
470 """Create an experiment.
471
472 :param name: The experiment name. Must be unique.
(...)
505 Lifecycle_stage: active
506 """
--> 507 return self._tracking_client.create_experiment(name, artifact_location, tags)
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/mlflow/tracking/_tracking_service/client.py:182, in TrackingServiceClient.create_experiment(self, name, artifact_location, tags)
179 _validate_experiment_name(name)
180 _validate_experiment_artifact_location(artifact_location)
--> 182 return self.store.create_experiment(
183 name=name,
184 artifact_location=artifact_location,
185 tags=[ExperimentTag(key, value) for (key, value) in tags.items()] if tags else [],
186 )
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/mlflow/store/tracking/file_store.py:321, in FileStore.create_experiment(self, name, artifact_location, tags)
319 def create_experiment(self, name, artifact_location=None, tags=None):
320 self._check_root_dir()
--> 321 self._validate_experiment_name(name)
322 # Get all existing experiments and find the one with largest numerical ID.
323 # len(list_all(..)) would not work when experiments are deleted.
324 experiments_ids = [
325 int(e.experiment_id)
326 for e in self.list_experiments(ViewType.ALL)
327 if e.experiment_id.isdigit()
328 ]
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/mlflow/store/tracking/file_store.py:303, in FileStore._validate_experiment_name(self, name)
299 if name is None or name == "":
300 raise MlflowException(
301 "Invalid experiment name '%s'" % name, databricks_pb2.INVALID_PARAMETER_VALUE
302 )
--> 303 experiment = self.get_experiment_by_name(name)
304 if experiment is not None:
305 if experiment.lifecycle_stage == LifecycleStage.DELETED:
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/mlflow/store/tracking/abstract_store.py:76, in AbstractStore.get_experiment_by_name(self, experiment_name)
66 def get_experiment_by_name(self, experiment_name):
67 """
68 Fetch the experiment by name from the backend store.
69 This is a base implementation using
list_experiments, derived classes may have(...)
74 :return: A single :py:class:
mlflow.entities.Experimentobject if it exists.75 """
---> 76 for experiment in self.list_experiments(ViewType.ALL):
77 if experiment.name == experiment_name:
78 return experiment
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/mlflow/store/tracking/file_store.py:261, in FileStore.list_experiments(self, view_type, max_results, page_token)
258 for exp_id in rsl:
259 try:
260 # trap and warn known issues, will raise unexpected exceptions to caller
--> 261 experiment = self._get_experiment(exp_id, view_type)
262 if experiment:
263 experiments.append(experiment)
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/mlflow/store/tracking/file_store.py:337, in FileStore._get_experiment(self, experiment_id, view_type)
335 def _get_experiment(self, experiment_id, view_type=ViewType.ALL):
336 self._check_root_dir()
--> 337 _validate_experiment_id(experiment_id)
338 experiment_dir = self._get_experiment_path(experiment_id, view_type)
339 if experiment_dir is None:
File ~/DevEnv/miniconda3/envs/quant_py38_arm/lib/python3.8/site-packages/mlflow/utils/validation.py:267, in _validate_experiment_id(exp_id)
265 """Check that
experiment_idis a valid string or None, raise an exception if it isn't."""266 if exp_id is not None and _EXPERIMENT_ID_REGEX.match(exp_id) is None:
--> 267 raise MlflowException(
268 "Invalid experiment ID: '%s'" % exp_id, error_code=INVALID_PARAMETER_VALUE
269 )
MlflowException: Invalid experiment ID: '.ipynb_checkpoints'
To Reproduce
Steps to reproduce the behavior:
Expected Behavior
Screenshot
Environment
Note: User could run
cd scripts && python collect_info.py allunder project directory to get system informationand paste them here directly.
Darwin
arm64
macOS-12.2.1-arm64-arm-64bit
Darwin Kernel Version 21.3.0: Wed Jan 5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_ARM64_T6000
Python version: 3.8.11 (default, Jul 29 2021, 14:57:32) [Clang 12.0.0 ]
Qlib version: 0.8.4.99
numpy==1.22.3
pandas==1.4.2
scipy==1.8.0
requests==2.25.1
sacred==0.8.2
python-socketio==5.5.2
redis==4.2.2
python-redis-lock==3.7.0
schedule==1.1.0
cvxpy==1.1.18
hyperopt==0.1.2
fire==0.4.0
statsmodels==0.13.2
xlrd==2.0.1
plotly==5.6.0
matplotlib==3.5.1
tables==3.7.0
pyyaml==6.0
mlflow==1.24.0
tqdm==4.61.2
loguru==0.6.0
lightgbm==3.3.2
tornado==6.1
joblib==1.1.0
fire==0.4.0
ruamel.yaml==0.17.21
Additional Notes
I installed qlib from source, and my conda env is the version for arm64