我无法使用mlflow.sklearn.load_model
. 在内部,使用模块mlflow
中的函数。_download_artifact_from_uri
mlflow.tracking.artifact_utils
如果我尝试下载整个工件文件夹,我会收到以下错误消息:PermissionError: [Errno 13] Permission denied: '/0'
.
如果我尝试从工件文件夹中检索单个文件,我不会收到错误消息,并且我可以使用该os
模块创建一个文件夹。
以下是我使用过的转换后的 jupyter notebook。
import os
import mlflow
from mlflow.tracking.artifact_utils import _download_artifact_from_uri
mlflow.set_tracking_uri("file:mlruns")
artifact_uri = 'ftp://user:pass@ftp/0/69a874f1f8a6474cae6bca5b3b5f9ffc/artifacts'
model_uri = 'ftp://user:pass@ftp/0/25f46678f1d44842910f185672ca852c/artifacts/linear model/model/MLmodel'
_download_artifact_from_uri(artifact_uri, "./mlruns")
---------------------------------------------------------------------------
PermissionError Traceback (most recent call last)
<ipython-input-14-834201128eef> in <module>
----> 1 _download_artifact_from_uri(artifact_uri, "./mlruns")
/opt/conda/lib/python3.7/site-packages/mlflow/tracking/artifact_utils.py in _download_artifact_from_uri(artifact_uri, output_path)
73
74 return get_artifact_repository(artifact_uri=root_uri).download_artifacts(
---> 75 artifact_path=artifact_path, dst_path=output_path)
/opt/conda/lib/python3.7/site-packages/mlflow/store/artifact/artifact_repo.py in download_artifacts(self, artifact_path, dst_path)
135 # Check if the artifacts points to a directory
136 if self._is_directory(artifact_path):
--> 137 return download_artifact_dir(artifact_path)
138 else:
139 return download_file(artifact_path)
/opt/conda/lib/python3.7/site-packages/mlflow/store/artifact/artifact_repo.py in download_artifact_dir(dir_path)
116 for file_info in dir_content:
117 if file_info.is_dir:
--> 118 download_artifact_dir(dir_path=file_info.path)
119 else:
120 download_file(file_info.path)
/opt/conda/lib/python3.7/site-packages/mlflow/store/artifact/artifact_repo.py in download_artifact_dir(dir_path)
116 for file_info in dir_content:
117 if file_info.is_dir:
--> 118 download_artifact_dir(dir_path=file_info.path)
119 else:
120 download_file(file_info.path)
/opt/conda/lib/python3.7/site-packages/mlflow/store/artifact/artifact_repo.py in download_artifact_dir(dir_path)
118 download_artifact_dir(dir_path=file_info.path)
119 else:
--> 120 download_file(file_info.path)
121 return local_dir
122 if not os.path.exists(dst_path):
/opt/conda/lib/python3.7/site-packages/mlflow/store/artifact/artifact_repo.py in download_file(fullpath)
101 local_file_path = os.path.join(dst_path, fullpath)
102 if not os.path.exists(local_dir_path):
--> 103 os.makedirs(local_dir_path)
104 self._download_file(remote_file_path=fullpath, local_path=local_file_path)
105 return local_file_path
/opt/conda/lib/python3.7/os.py in makedirs(name, mode, exist_ok)
209 if head and tail and not path.exists(head):
210 try:
--> 211 makedirs(head, exist_ok=exist_ok)
212 except FileExistsError:
213 # Defeats race condition when another thread created the path
/opt/conda/lib/python3.7/os.py in makedirs(name, mode, exist_ok)
209 if head and tail and not path.exists(head):
210 try:
--> 211 makedirs(head, exist_ok=exist_ok)
212 except FileExistsError:
213 # Defeats race condition when another thread created the path
/opt/conda/lib/python3.7/os.py in makedirs(name, mode, exist_ok)
209 if head and tail and not path.exists(head):
210 try:
--> 211 makedirs(head, exist_ok=exist_ok)
212 except FileExistsError:
213 # Defeats race condition when another thread created the path
/opt/conda/lib/python3.7/os.py in makedirs(name, mode, exist_ok)
209 if head and tail and not path.exists(head):
210 try:
--> 211 makedirs(head, exist_ok=exist_ok)
212 except FileExistsError:
213 # Defeats race condition when another thread created the path
/opt/conda/lib/python3.7/os.py in makedirs(name, mode, exist_ok)
219 return
220 try:
--> 221 mkdir(name, mode)
222 except OSError:
223 # Cannot rely on checking for EEXIST, since the operating system
PermissionError: [Errno 13] Permission denied: '/0'
_download_artifact_from_uri(model_uri, "./mlruns")
'/home/jovyan/notebooks/mlruns/MLmodel'
os.mkdir("mlruns/0")