使用ML_Flow Load_model自动检测?
我正在使用MLFlow,并希望处理不同的口味(例如Sklearn
,Tensorflow
和keras
)。
实际上,我只在输出中找到有关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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
mlflow.pyfunc.pyfunc.pyfunc 说:
这意味着您可以使用
mlflow.pyfunc.load_model
加载所有支持的MLFlow口味。The documentation of mlflow.pyfunc says:
This means you can use
mlflow.pyfunc.load_model
to load all mlflow supported flavors.