使用ML_Flow Load_model自动检测?

发布于 2025-01-24 05:52:35 字数 1066 浏览 0 评论 0原文

我正在使用MLFlow,并希望处理不同的口味(例如SklearnTensorflowkeras)。

实际上,我只在输出中找到有关straim的信息

Run.to_dictionary()['data']['tags']['mlflow.log-model.history']

[{"run_id": "8ea47843f7b446828dbd9cd3a1ed2339", "artifact_path": "model", "utc_time_created": "2022-04-26 10:39:55.639791", "flavors": {"keras": {"keras_module": "tensorflow.keras", "keras_version": "2.7.0", "save_format": "tf", "data": "data", "code": null}, "python_function": {"loader_module": "mlflow.keras", "python_version": "3.8.10", "data": "data", "env": "conda.yaml"}}, "model_uuid": "3bd37bdb0aa1409aabc65f8314018642", "mlflow_version": "1.25.1"}]

运行是mlflow.entities.run对象。

使用ast.literal_eval将字符串转换为字典失败。

ast.literal_eval(str(self.run.to_dictionary()['data']['tags']['mlflow.log-model.history'][1:-1]))

I am using mlflow and want to handle different flavors (e.g. sklearn , tensorflow and keras) while loading.

Actually I only find the information about the stored flavor as string in

Run.to_dictionary()['data']['tags']['mlflow.log-model.history']

output:

[{"run_id": "8ea47843f7b446828dbd9cd3a1ed2339", "artifact_path": "model", "utc_time_created": "2022-04-26 10:39:55.639791", "flavors": {"keras": {"keras_module": "tensorflow.keras", "keras_version": "2.7.0", "save_format": "tf", "data": "data", "code": null}, "python_function": {"loader_module": "mlflow.keras", "python_version": "3.8.10", "data": "data", "env": "conda.yaml"}}, "model_uuid": "3bd37bdb0aa1409aabc65f8314018642", "mlflow_version": "1.25.1"}]

Run is the mlflow.entities.Run object.

Using ast.literal_eval to transform the string into the dictionary fails.

ast.literal_eval(str(self.run.to_dictionary()['data']['tags']['mlflow.log-model.history'][1:-1]))

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

暗喜 2025-01-31 05:52:35

mlflow.pyfunc.pyfunc.pyfunc 说:

Python_Function模型风味是MLFLOW PYTHON模型的默认模型接口。任何MLFlow Python模型都可以作为Python_Function模型加载。

这意味着您可以使用mlflow.pyfunc.load_model加载所有支持的MLFlow口味。

The documentation of mlflow.pyfunc says:

The python_function model flavor serves as a default model interface for MLflow Python models. Any MLflow Python model is expected to be loadable as a python_function model.

This means you can use mlflow.pyfunc.load_model to load all mlflow supported flavors.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文