![Integration Test](https://github.com/Azure/aml-run/workflows/Integration%20Test/badge.svg?branch=master&event=push)
![Lint and Test](https://github.com/Azure/aml-run/workflows/Lint%20and%20Test/badge.svg?branch=master&event=push)
# GitHub Action for training Machine Learning Models using Azure
## Usage
The Azure Machine Learning training action will help you train your models on [Azure Machine Learning](https://azure.microsoft.com/en-us/services/machine-learning/) using GitHub Actions.
Get started today with a [free Azure account](https://azure.com/free/open-source)!
This repository contains a GitHub Action for training machine learning models using Azure Machine Learning in a few different ways, each with different capabilities. To submit a training run, you have to define your python file(s) that should run remotely as well as a config file corresponding to [one of the supported methods of training](https://docs.microsoft.com/en-us/azure/machine-learning/concept-train-machine-learning-model#python-sdk)
## Dependencies on other GitHub Actions
* [Checkout](https://github.com/actions/checkout) Checkout your Git repository content into GitHub Actions agent.
* [aml-workspace](https://github.com/Azure/aml-workspace) This action requires an Azure Machine Learning workspace to be present. You can either create a new one or re-use an existing one using the action.
* [aml-compute](https://github.com/Azure/aml-compute) You can use this action to create a new traininig environment if your workspace doesnt have one already.
## Utilize GitHub Actions and Azure Machine Learning to train and deploy a machine learning model
This action is one in a series of actions that can be used to setup an ML Ops process. **We suggest getting started with one of our template repositories**, which will allow you to create an ML Ops process in less than 5 minutes.
1. **Simple template repository: [ml-template-azure](https://github.com/machine-learning-apps/ml-template-azure)**
Go to this template and follow the getting started guide to setup an ML Ops process within minutes and learn how to use the Azure Machine Learning GitHub Actions in combination. This template demonstrates a very simple process for training and deploying machine learning models.
2. **Advanced template repository: [aml-template](https://github.com/Azure/aml-template)**
This template demonstrates how the actions can be extended to include the normal pull request approval process and how training and deployment workflows can be split. More enhancements will be added to this template in the future to make it more enterprise ready.
## Example workflow for training Machine Learning Models using Azure
```yaml
name: My Workflow
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Check Out Repository
id: checkout_repository
uses: actions/checkout@v2
# AML Workspace Action
- uses: Azure/aml-workspace@v1
id: aml_workspace
with:
azure_credentials: ${{ secrets.AZURE_CREDENTIALS }}
# AML Run Action
- uses: Azure/aml-run@v1
id: aml_run
with:
# required inputs as secrets
azure_credentials: ${{ secrets.AZURE_CREDENTIALS }}
# optional
parameters_file: "run.json"
```
### Inputs
| Input | Required | Default | Description |
| ----- | -------- | ------- | ----------- |
| azure_credentials | x | - | Output of `az ad sp create-for-rbac --name <your-sp-name> --role contributor --scopes /subscriptions/<your-subscriptionId>/resourceGroups/<your-rg> --sdk-auth`. This should be stored in your secrets |
| parameters_file | | `"run.json"` | We expect a JSON file in the .cloud/.azure folder in root of your repository specifying details of your Azure Machine Learning Run. If you have want to provide these details in a file other than "run.json" you need to provide this input in the action. |
#### azure_credentials (Azure Credentials)
Azure credentials are required to connect to your Azure Machine Learning Workspace. These may have been created for an action you are already using in your repository, if so, you can skip the steps below.
Install the [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest) on your computer or use the Cloud CLI and execute the following command to generate the required credentials:
```sh
# Replace {service-principal-name}, {subscription-id} and {resource-group} with your Azure subscription id and resource group name and any name for your service principle
az ad sp create-for-rbac --name {service-principal-name} \
--role contributor \
--scopes /subscriptions/{subscription-id}/resourceGroups/{resource-group} \
--sdk-auth
```
This will generate the following JSON output:
```sh
{
"clientId": "<GUID>",
"clientSecret": "<GUID>",
"subscriptionId": "<GUID>",
"tenantId": "<GUID>",
(...)
}
```
Add this JSON output as [a secret](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets#creating-encrypted-secrets) with the name `AZURE_CREDENTIALS` in your GitHub repository.
#### parameters_file (Parameter File)
The action tries to load a JSON file in the `.cloud/.azure` folder in your repository, which specifies details of your Azure Machine Learning Run. By default, the action is looking for a file with the name `"run.json"`. If your JSON file has a different name, you can specify it with this parameter. Note that none of these values are required and in the absence, defaults will be created with a combination of the repo name and branch name.
A sample file can be found in this repository in the folder `.cloud/.azure`. The JSON file can include the following parameters:
| Parameter Name | Required | Allowed Values | Default | Description |
| --------------------- | -------- | ------------------------ | ---------- | ----------- |
| experiment_name | | str | <REPOSITORY_NAME>-<BRANCH_NAME> | The name of your experiment in AML, which must be 3-36 characters, start with a letter or a number, and can only contain letters, numbers, underscores, and dashes. |
| tags | | dict: {"<your-run-tag-key>": "<your-run-tag-value>", ...} | null | Tags to be added to the submitted run. |
| wait_for_completion | | bool | true | Indicates whether the action will wait for completion of the run |
| download_artifacts | | bool | false | Indicates whether the created artifacts and logs from runs, pipelines and steps will be downloaded to your GitHub workspace. This only works if `wait_for_completion` is set to true. |
| pipeline_publish | | bool | false | Indicates whether the action will publish the pipeline after submitting it to Azure Machine Learning. This only works if you submitted a pipeline. |
| pipeline_name | | str | <REPOSITORY_NAME>-<BRANCH_NAME> | The name of the published pipeline. This only works if you submitted a pipeline. |
| pipeline_version | | str | null | The version of the published pipeline. This only works if you submitted a pipeline. |
| pipeline_continue_on_step_failure | | bool | false | Indicates whether the published pipeline will continue execution of other steps in the PipelineRun if a step fails. This only works if you submitted a pipeline. |
##### Inputs specific to method of training
- Using a python script (default `code/train/run_config.py`) which includes a function (default `def main(workspace):`) that describes your run t
没有合适的资源?快使用搜索试试~ 我知道了~
aml-run:GitHub操作,可让您将运行提交到Azure机器学习工作区
共30个文件
py:9个
yml:8个
json:6个
需积分: 3 1 下载量 39 浏览量
2021-01-28
10:46:40
上传
评论
收藏 29KB ZIP 举报
温馨提示
GitHub Action使用Azure训练机器学习模型 用法 Azure机器学习培训操作将帮助您使用GitHub Actions在上训练模型。 立即开始使用! 该存储库包含一个GitHub Action,用于使用Azure机器学习以几种不同的方式来训练机器学习模型,每种方式具有不同的功能。 要提交训练运行,您必须定义应远程运行的python文件以及相对应的配置文件 对其他GitHub动作的依赖 将您的Git存储库内容签入GitHub Actions代理。 此操作要求存在Azure机器学习工作空间。 您可以使用该动作创建一个新的或重新使用一个现有的。 如果您的工作空间还没有,可以使用此操作创建一个新的Traininig环境。 利用GitHub Actions和Azure机器学习来训练和部署机器学习模型 此操作是可用于设置ML Ops流程的一系列操作中的一个。 我们建议您开始使用我们的模板存储库之一,它可以让您在不到5分钟的时间内创建ML Ops流程。 简单的模板存储库: 转到此模板并按照入门指南在几分钟之内设置ML Ops流程,并学习如何结合使用Azure Machine
资源详情
资源评论
资源推荐
收起资源包目录
aml-run-master.zip (30个子文件)
aml-run-master
.github
workflows
versioning.yml 301B
integration.yml 1KB
python.yml 739B
synch_docs.yml 1KB
CODEOWNERS 19B
Dockerfile 128B
SECURITY.md 3KB
tests
test_utils.py 4KB
train
train_with_python_config
environment.yml 202B
train.py 5KB
run_config.py 780B
train_with_yaml_run_config
environment.yml 379B
train.py 5KB
run_config.yml 4KB
objects.py 6KB
test_main.py 902B
action.yml 2KB
LICENSE 1KB
code
main.py 13KB
utils.py 6KB
schemas.py 3KB
entrypoint.sh 40B
.cloud
.azure
run.json 605B
test
test_aks_compute.json 119B
test_workspace.json 237B
train_with_python_config.json 281B
train_with_yaml_run_config.json 251B
test_aml_compute.json 180B
CODE_OF_CONDUCT.md 444B
README.md 14KB
共 30 条
- 1
weixin_38706782
- 粉丝: 2
- 资源: 929
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0