訓練
認證
Microsoft Certified: Azure Data Scientist Associate - Certifications
使用 Python、Azure Machine Learning 和 MLflow 來管理資料擷取和準備、訓練及部署模型,以及監視機器學習解決方案。
適用於:Azure CLI ml 延伸模組 v2 (目前)
Python SDK azure-ai-ml v2 (目前)
本文會說明 MLflow (英文) 的功能,這是一種開放原始碼架構,旨在管理完整的機器學習生命週期。 MLflow 會使用一致的工具組,在不同的平台上定型及提供模型。 無論您的實驗是在本機或遠端計算目標、虛擬機器或 Azure Machine Learning 計算執行個體上執行,都可以使用 MLflow。
Azure Machine Learning 工作區與 MLflow 相容,這表示您可以採取與使用 MLflow 伺服器相同的方式使用 Azure Machine Learning 工作區。 此相容性具有下列優點:
提示
不同於 Azure Machine Learning SDK v1,Azure Machine Learning v2 SDK 中沒有記錄功能。 您可以使用 MLflow 記錄來確保您的定型常式與雲端無關、可攜,並且對 Azure Machine Learning 不具有任何相依性。
當您使用作業時,Azure 機器學習 會自動追蹤實驗的一些資訊,例如程式代碼、環境和輸入和輸出數據。 不過,模型、參數和計量是案例特有的,因此模型產生器必須設定其追蹤。
儲存的追蹤元數據會依實驗而有所不同,而且可以包括:
無論您在 Azure 機器學習 中使用作業定型模型,還是以互動方式在筆記本中訓練模型,實驗追蹤都可協助您:
Azure 機器學習 工作區與 MLflow 相容。 此相容性表示您可以使用 MLflow 來追蹤工作區中的執行、計量、參數和成品,而不需要變更訓練例程或插入任何雲端特定語法。 若要瞭解如何使用 MLflow 來追蹤實驗,並在 Azure 機器學習 工作區中執行,請參閱使用 MLflow 追蹤實驗和模型。
Azure Machine Learning 會使用 MLflow 追蹤來記錄計量,並儲存實驗的成品。 當您連線到 Azure Machine Learning 時,所有 MLflow 追蹤都會您正在使用的工作區中具體化。
若要瞭解如何啟用記錄以使用 MLflow 監視即時執行計量,請參閱 使用 MLflow 記錄計量、參數和檔案。 您也可以使用 MLflow 查詢、比較實驗和執行 (英文)。
Azure Machine Learning 中的 MLflow 可讓您集中追踪。 即使您在本機工作或在不同的雲端中工作,也可以將 MLflow 連線到 Azure Machine Learning 工作區。 Azure Machine Learning 工作區會提供集中、安全且可擴充的位置來儲存定型計量和模型。
Azure Machine Learning 中的 MLflow 可以:
R 中的 MLflow 支援有下列限制:
如需在 Azure Machine Learning 中搭配 R 模型使用 MLflow 追蹤用戶端的範例,請參閱使用 Azure Machine Learning CLI (v2) 定型 R 模型 (英文)。
Java 中的 MLflow 支援有下列限制:
outputs
資料夾使用 mlflow.save_model
方法來儲存您想要擷取的模型或成品。如需使用搭配 Azure Machine Learning 追蹤伺服器使用 MLflow 追蹤用戶端的 Java 範例,請參閱 azuremlflow-java (英文)。
Azure Machine Learning 支援用於模型管理的 MLflow。 對於熟悉 MLflow 用戶端的使用者來說,此支援是管理整個模型生命週期相當便利的方式。 如需有關如何使用 Azure Machine Learning 中的 MLflow API 來管理模型的詳細資訊,請參閱使用 MLflow 管理 Azure Machine Learning 中的模型登錄 (英文)。
使用 MLflow 進行模型管理 (英文) 會示範如何管理登錄中的模型。
您可以將 MLflow 模型部署至 Azure Machine Learning,以利用更好的體驗。 Azure Machine Learning 支援將 MLflow 模型部署至即時和批次端點,而不需要指定環境或評分指令碼。
MLflow SDK、Azure Machine Learning CLI、適用於 Python 的 Azure Machine Learning SDK 以及 Azure Machine Learning 工作室全都支援 MLflow 模型部署。 如需有關如何將 MLflow 模型部署至 Azure Machine Learning 以進行即時和批次推斷的詳細資訊,請參閱部署 MLflow 模型的指導方針。
警告
Azure Machine Learning 中的 MLproject
檔案 (MLflow 專案) 支援將於 2026 年 9 月完全淘汰。 MLflow 仍然完全支援,而且仍然是追蹤 Azure Machine Learning 中機器學習工作負載的建議方式。
當您繼續使用 MLflow 時,建議您使用 Azure CLI 或適用於 Python 的 Azure Machine Learning SDK (v2),從 MLproject
檔案轉換至 Azure Machine Learning 作業。 如需 Azure Machine Learning 作業的詳細資訊,請參閱使用 MLflow 追蹤 ML 實驗和模型。
重要
此功能目前處於公開預覽。 此預覽版本沒有服務等級協定,不建議用於處理生產工作負載。 可能不支援特定功能,或可能已經限制功能。
如需詳細資訊,請參閱 Microsoft Azure 預覽版增補使用條款。
您可以使用 MLflow 專案 (英文) 將定型作業提交至 Azure Machine Learning。 您可以使用 Azure Machine Learning 追蹤在本機提交作業,或透過 Azure Machine Learning Compute 將您的作業移轉至雲端。
若要了解如何將使用 MLflow 專案的定型作業提交至 Azure Machine Learning 工作區以進行追蹤,請參閱在 Azure Machine Learning 中使用 MLflow 專案來定型 (預覽) (英文)。
下表會示可以使用 MLflow SDK 和 Azure Machine Learning 用戶端工具執行的機器學習生命週期作業。
功能 | MLflow SDK | Azure Machine Learning CLI/SDK v2 | Azure Machine Learning Studio |
---|---|---|---|
追蹤和記錄計量、參數和模型 | ✓ | ||
擷取計量、參數和模型 | ✓ | 只能下載成品和模型。 | ✓ |
提交定型作業 | 可以使用 MLflow 專案 (預覽) 來進行。 | ✓ | ✓ |
使用 Azure Machine Learning 資料資產提交定型作業 | ✓ | ✓ | |
使用機器學習管線提交定型作業 | ✓ | ✓ | |
管理實驗和執行 | ✓ | ✓ | ✓ |
管理 MLflow 模型 | 可能不支援部分作業。1 | ✓ | ✓ |
管理非 MLflow 模型 | ✓ | ✓ | |
將 MLflow 模型部署至 Azure Machine Learning (線上和批次) | 目前不支援部署用於批次推斷的 MLflow 模型。2 | ✓ | ✓ |
將非 MLflow 模型部署至 Azure Machine Learning | ✓ | ✓ |
1 如需詳細資料,請參閱使用 MLflow 管理 Azure Machine Learning 中的模型登錄 (英文)。
2 如需替代方案,請參閱在 Spark 作業中部署和執行 MLflow 模型 (英文)。
訓練
認證
Microsoft Certified: Azure Data Scientist Associate - Certifications
使用 Python、Azure Machine Learning 和 MLflow 來管理資料擷取和準備、訓練及部署模型,以及監視機器學習解決方案。