gpt4 book ai didi

google-colaboratory - 在 Google Colab 上设置 MLflow

转载 作者:行者123 更新时间:2023-12-04 14:35:31 28 4
gpt4 key购买 nike

我经常使用 Google Colab 来训练 TF/PyTorch 模型,因为 Colab 为我提供了 GPU/TPU 运行时。此外,我喜欢使用 MLflow 来存储和比较训练模型、跟踪进度、共享等。将 MLflow 与 Google Colab 一起使用有哪些可用的解决方案?

最佳答案

有一个Github issue关于这一点,尽管在撰写本文时它仍然是开放的 [编辑:刚刚关闭],贡献者 dmatrix 很友好地提供了 notebook提供完整的解决方案,使用 pyngrok .
这是代码(旨在在 Colab 笔记本上运行),在此处使用隐式 permission of the author 重新发布:

!pip install mlflow --quiet
!pip install pyngrok --quiet

import mlflow

with mlflow.start_run(run_name="MLflow on Colab"):
mlflow.log_metric("m1", 2.0)
mlflow.log_param("p1", "mlflow-colab")

# run tracking UI in the background
get_ipython().system_raw("mlflow ui --port 5000 &") # run tracking UI in the background


# create remote tunnel using ngrok.com to allow local port access
# borrowed from https://colab.research.google.com/github/alfozan/MLflow-GBRT-demo/blob/master/MLflow-GBRT-demo.ipynb#scrollTo=4h3bKHMYUIG6

from pyngrok import ngrok

# Terminate open tunnels if exist
ngrok.kill()

# Setting the authtoken (optional)
# Get your authtoken from https://dashboard.ngrok.com/auth
NGROK_AUTH_TOKEN = ""
ngrok.set_auth_token(NGROK_AUTH_TOKEN)

# Open an HTTPs tunnel on port 5000 for http://localhost:5000
ngrok_tunnel = ngrok.connect(addr="5000", proto="http", bind_tls=True)
print("MLflow Tracking UI:", ngrok_tunnel.public_url)
其输出将是 pyngrok - 生成的网址如:
MLflow Tracking UI: https://0a23d7a7d0c4.ngrok.io
单击这将导致 MLfLow GUI 屏幕。
(感谢 pyngrok 创建者, Alex Laird 对原始代码的轻微修改)
使用 MLflow 版本 1.10.0 和 1.11.0 进行测试。

关于google-colaboratory - 在 Google Colab 上设置 MLflow,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61615818/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com