Home

Awesome

Setup CML Action

CML

Continuous Machine Learning (CML) is an open-source library for implementing continuous integration & delivery (CI/CD) in machine learning projects. Use it to automate parts of your development workflow, including machine provisioning; model training and evaluation; comparing ML experiments across your project history, and monitoring changing datasets.

The iterative/setup-cml can be used as a GitHub Action to provide CML functions in your workflow. The action allows users to install CML without using the CML Docker container.

This action gives you:

Note that CML does not include DVC and its dependencies (see the Setup DVC Action).

Note on v1

v1 of this action uses npm install to install CML, on to the system, CML has a dependency which requires node 16, the github actions default environment now has node 18 by default, see reference on preinstalled software

To have a consistent experience you should:

example:

      ...
      - uses: actions/setup-node@v3
        with:
          node-version: 16
      - uses: iterative/setup-cml@v1
      ...

Usage

This action is tested on ubuntu-latest, macos-latest and windows-latest.

Basic usage:

steps:
  - uses: actions/checkout@v3
  - uses: iterative/setup-cml@v1

A specific version can be pinned to your workflow.

steps:
  - uses: actions/checkout@v3
  - uses: iterative/setup-cml@v1
    with:
      version: '0.18.1'

Self-hosted example:

runs-on: [self-hosted]
steps:
  - uses: actions/setup-node@v3
    with:
      node-version: '16'
  - uses: actions/checkout@v3
  - uses: iterative/setup-cml@v1
    with:
      sudo: false

Inputs

The following inputs are supported.

A complete example

A sample CML report from a machine learning project displayed in a Pull Request.

Assume that we have a machine learning script, train.py which outputs an image plot.png:

steps:
  - uses: actions/checkout@v2
  - uses: iterative/setup-cml@v1
  - env:
      REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Can use the default token for most functions
    run: |
      python train.py --output plot.png

      echo 'My first CML report' > report.md
      echo '![](./plot.png)' >> report.md
      cml comment create --publish report.md

In general GitHub's runner token can be given enough permissions to perform most functions. When using the cml runner launch command a PAT is required

CML functions

CML provides several helper functions. See the docs.