在GCS存储桶中记录MLFlow的制品

4
我在GCS VM实例上运行着一个MlFlow服务器。我创建了一个桶来记录工件。 这是我正在运行的启动服务器的命令和指定桶路径的方式-
mlflow server --default-artifact-root gs://gcs_bucket/artifacts --host x.x.x.x

但是面对这个错误:

TypeError: stat: path should be string, bytes, os.PathLike or integer, not ElasticNet

注意- Mlflow服务器在指定的主机上运行良好。问题在于当我指定存储桶路径时的方法。 使用以下命令授予了存储API的权限:

gcloud auth application-default login
gcloud auth login

此外,关于打印工件URI,这是我得到的结果:
mlflow.get_artifact_uri()

输出:

gs://gcs_bucket/artifacts/0/122481bf990xxxxxxxxxxxxxxxxxxxxx/artifacts

所以在上面的路径中,从哪里来的这个 0/122481bf990xxxxxxxxxxxxxxxxxxxxx/artifacts,为什么它没有在 gs://gcs_bucket/artifacts 自动创建?

经过更多调试,为什么它无法从 VM 获取本地路径:

enter image description here

我在 VM 上收到了这个错误:

ARNING:root:Malformed experiment 'mlruns'. Detailed error Yaml file './mlruns/mlruns/meta.yaml' does not exist.
Traceback (most recent call last):
 File "/usr/local/lib/python3.6/dist-packages/mlflow/store/tracking/file_store.py", line 197, in list_experiments
   experiment = self._get_experiment(exp_id, view_type)
 File "/usr/local/lib/python3.6/dist-packages/mlflow/store/tracking/file_store.py", line 256, in _get_experiment
   meta = read_yaml(experiment_dir, FileStore.META_DATA_FILE_NAME)
 File "/usr/local/lib/python3.6/dist-packages/mlflow/utils/file_utils.py", line 160, in read_yaml
   raise MissingConfigException("Yaml file '%s' does not exist." % file_path)
mlflow.exceptions.MissingConfigException: Yaml file './mlruns/mlruns/meta.yaml' does not exist.

我能得到解决方案吗?还有我缺少了什么?


1
请查看 https://www.mlflow.org/docs/latest/tracking.html#google-cloud-storage 。可能是权限设置出了问题。请尝试按照文档中的说明进行操作并详细说明您的问题。 - Serhii Rohoza
1
您是否已经为运行此命令的账户授予权限?如果没有,请尝试添加“存储对象查看器”和“存储对象创建器”以检查其是否有效。 - Ralemos
我已经更新了问题,请查看并尝试回答@SerhiiRohoza。 - Shadab Hussain
我已经授予这些权限了 @ralemos - Shadab Hussain
这些权限应该足以允许您所尝试的操作,你能否尝试切换到“存储管理员”角色,以便我们可以检查权限?此外,您可以尝试像这样使用服务帐号从实例中创建对象。 - Ralemos
显示剩余2条评论
1个回答

1
我认为主要错误来自您想要部署的结构。针对您的用例,适合使用此处所示的结构。因此,您错过了用于存储后端元数据的URI路径。请先安装DB SQL(PostgreSQL等),然后将路径添加到--backend-storage-uri。
如果您想将MlFlow用作模型注册表并在gcs上存储图像,则可以使用此处的结构,并添加标签--artifacts-only--serve-artifacts
希望这可以帮助您。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接