Skip to content

Commit a53e6e2

Browse files
authored
Update README.md
1 parent 71431f9 commit a53e6e2

1 file changed

Lines changed: 92 additions & 2 deletions

File tree

README.md

Lines changed: 92 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,92 @@
1-
# Algorithmia CI - Model Deployment
2-
Github action to run a notebook and conditionally deploy the output model to Algorithmia [WIP]
1+
# Algorithmia Github Action for Continuous Deployment between an ML Repo at Github and Algorithmia
2+
3+
## When to use?
4+
After you create an algorithm on Algorithmia as the scalable inference endpoint for your ML model, you can incorporate this Github Action to your Github ML repository's workflow file, to automate deploying your model and your inference (algorithm) code.
5+
6+
This action would be a good fit for your workflow if you are using a Jupyter notebook to train and evaluate your ML model or checking your saved model file into your repository and you have your inference (algorithm) script & dependencies in your ML repo. The Github Action will get deploy your model file to a data collection at Algorithmia and create a new build for your inference endpoint to use the new model, whenever you do a Git push to your master branch (or any other triggering event you configure).
7+
8+
## How does it work?
9+
10+
Depending on your model development preference:
11+
12+
If you're developing your ML model on a Jupyter notebook, you can configure the workflow with the notebook path and tell it where to save the model file. In this case, the workflow will run the notebook on the CI worker machine's from-scratch environment. Through our utility script, your notebook will get the path for where to save the ML model object.
13+
If you have an already saved model checked-in to your repository, you can configure the workflow with the existing model file path.
14+
15+
In both scenarios, the workflow will get the model file and upload it to the configured data collection on Algorithmia.
16+
17+
## What other perks does it have?
18+
To get your inference endpoint use this newly uploaded model, the workflow will make the connection between your inference algorithm and the uploaded model file, with the key-value pairs in `model_manifest.json` file.
19+
In addition to that, the manifest file will contain certain metadata such as:
20+
- Which Github repository and which ref was this model file uploaded from?
21+
- What was the MD5 hash of your model file when it was first created?
22+
- What is the Github commit SHA and the commit message resulting in this automated upload?
23+
- When did this upload happen?
24+
25+
By using this manifest, your inference script will know which model to load and use. It can also calculate the loaded model file's MD5 hash with the original MD5 hash that was calculated at the time of the upload, and make sure that the model file hasn't been changed.
26+
27+
## How is it configured?
28+
29+
The inputs to this Github Action is as follows. Please check the default values of some of them, and make sure to include them in your own ML repo's workflow file if you want a non-default configuration for these.
30+
31+
```
32+
inputs:
33+
algorithmia_api_key:
34+
description: 'Algorithmia API Key, used when uploading the model file'
35+
required: true
36+
algorithmia_username:
37+
description: 'Algorithmia Username, used as Git Commit Username and as part of default model upload path'
38+
required: true
39+
algorithmia_email:
40+
description: 'Algorithmia Email, used as Git Commit Email'
41+
required: true
42+
algorithmia_password:
43+
description: 'Algorithmia Password. Only required if the algorithm is hosted on Algorithmia.'
44+
required: false
45+
github_username:
46+
description: 'Github username owning the algorithm repository, used to clone the algorithm repository. Only required if the algorithm is hosted on Github.'
47+
required: false
48+
github_pat:
49+
description: 'Github Personal Access Token, used to clone the algorithm repository. Only required if the algorithm is hosted on Github.'
50+
required: false
51+
algorithmia_algoname:
52+
description: 'Algorithmia Algorithm name'
53+
required: true
54+
algorithmia_uploadpath:
55+
description: 'Algorithmia data collection name to upload the model file'
56+
required: true
57+
default: 'data://$ALGORITHMIA_USERNAME/$ALGORITHMIA_ALGONAME'
58+
model_path:
59+
description: 'Path of the model file to be uploaded to Algorithmia'
60+
required: true
61+
default: 'model.pkl'
62+
notebook_path:
63+
description: 'Path of the notebook to be executed by this action'
64+
required: false
65+
default: 'model_training.ipynb'
66+
git_host:
67+
description: Git host for the Algorithmia algorithm repository. Change to git.algorithmia.com if the algorithm is hosted on Algorithmia.
68+
required: false
69+
default: 'github.com'
70+
runs:
71+
using: 'docker'
72+
image: 'Dockerfile'
73+
args:
74+
- ${{ inputs.algorithmia_api_key }}
75+
- ${{ inputs.algorithmia_username }}
76+
- ${{ inputs.algorithmia_email }}
77+
- ${{ inputs.algorithmia_algoname }}
78+
- ${{ inputs.algorithmia_password }}
79+
- ${{ inputs.github_username }}
80+
- ${{ inputs.github_pat }}
81+
- ${{ inputs.algorithmia_uploadpath }}
82+
- ${{ inputs.model_path }}
83+
- ${{ inputs.notebook_path }}
84+
- ${{ inputs.git_host }}
85+
```
86+
87+
88+
## Are there any example repositories using this Github Action?
89+
Of course :) Check out the two example ML repos that incorporate this Github Action to continuously deploy
90+
* [to an Algorithmia algorithm backed by Algorithmia](https://github.com/algorithmiaio/githubactions-modeldeployment-demo-algorithmiaalgo)
91+
* [to an Algorithmia algorithm backed by Github](https://github.com/algorithmiaio/githubactions-modeldeployment-demo-githubalgo)
92+

0 commit comments

Comments
 (0)