Awesome
Setup CML Action
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:
- Access to all CML functions.
For example:
cml comment create
for publishing data visualization and metrics from your CI workflow as comments in a pull request.cml pr create
to open a pull request.cml runner launch
, a function that enables workflows to provision cloud and on-premise computing resources for training models.
- The freedom 🦅 to mix and match CML with your favorite data science tools and environments.
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:
- migrate to
iterative/setup-cml@v2
which installs CML using its prebuilt binaries (packaged to contain the correct version of node) - or use
actions/setup-node@v3
to install node 16 beforeiterative/setup-cml@v1
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.
version
- (optional) The version of CML to install (e.g. '0.18.1'). Defaults tolatest
for the most recent CML release.sudo
- (optional) Enables the use of sudo whilst installing CML. Defaults totrue
force
- (optional) Forces the install. Useful in scenarios where CML is already installed and in use. Defaults tofalse
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.