簡體   English   中英

使用 Kedro 掛鈎將 git_sha 作為參數記錄在 Mlflow 上

[英]Logging the git_sha as a parameter on Mlflow using Kedro hooks

我想在 Mlflow 上記錄 git_sha 參數,如文檔中所示。 在我看來,只需運行以下代碼部分就足以讓 git_sha 登錄到 Mlflow UI。 我對嗎?

@hook_impl
    def before_pipeline_run(self, run_params: Dict[str, Any]) -> None:
        """Hook implementation to start an MLflow run
        with the same run_id as the Kedro pipeline run.
        """
        mlflow.start_run(run_name=run_params["run_id"])
        mlflow.log_params(run_params)

但這不起作用,因為我得到了除了 git_sha 參數之外的所有參數。 當我查看hooks specs時,似乎這個參數不是 run_params 的一部分(不再了嗎?)

有沒有辦法獲得 git sha(可能來自上下文日志?)並將其添加到記錄的參數中?

先感謝您 !

盡管強烈建議將 git 與 Kedro 一起使用,但這不是必需的,因此 Kedro 的任何部分(如果我們是迂腐的,除了kedro-starters )都不會“意識到” git。

在您的before_pipeline_hook中,您可以通過此處記錄的技術輕松檢索信息。 對於整個代碼庫而言,這似乎微不足道,如果您想說提供管道特定的哈希值,則涉及更多。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM