-
Notifications
You must be signed in to change notification settings - Fork 23
Added Github Actions example #251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| ## GitHub Actions workflow using NLU.DevOps CLI tool | ||
|
|
||
| This document covers setting up a CI pipeline for LUIS using GitHub Actions and NLU.DevOps. | ||
| The workflow will be the following: | ||
| 1. create, train, publish the LUIS model using sample utterances | ||
| 2. send a test set to created LUIS model | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. run a batch test against the model through the LUIS prediction API |
||
| 3. evaluate model by comparing results received from LUIS with expected values | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| 4. delete the model from the portal | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. delete the LUIS app resources created for testing |
||
|
|
||
| Supply a name for the action and set it up to trigger on pull requests. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like we should start a new sub-section here. |
||
|
|
||
| ``` | ||
| name: CINLU | ||
|
|
||
| on: [pull_request] | ||
| ``` | ||
|
|
||
| 1. Install NLU.DevOps CLI tool on GitHub agent. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rather than using ordered list items, maybe we should just break these into sub-sections. I.e., this one could be called: |
||
|
|
||
| ``` | ||
| - name: Install dotnet-nlu | ||
| run: dotnet tool install -g dotnet-nlu | ||
| ``` | ||
| For Ubuntu agents, you need to prepend a directory to the system PATH variable for all subsequent actions in the current job to make sure that CLI tool works. More about this command [here](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions#add-a-system-path-add-path). | ||
|
|
||
| ``` | ||
| - name: Path | ||
| run: echo "::add-path::$HOME/.dotnet/tools" | ||
| ``` | ||
| We use [utterances.json](../models/utterances.json) for training. You can replace this file with another file that consists of intents, utterances, entities that you need for your own model. | ||
| More about the format of this file [here](https://github.com/microsoft/NLU.DevOps/blob/master/docs/GenericUtterances.md). | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can just use the relative path |
||
| To train your model we should add the following: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clarify that we're using the NLU.DevOps CLI for training the LUIS model, but you can also use any other tool, such as the Bot Framework CLI.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Create sub-section header for training. |
||
|
|
||
| ``` | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mark these code fences as |
||
| - name: Train Luis model | ||
| run: dotnet nlu train -s luis -u utterances.json --save-appsettings | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This probably won't work without also including the |
||
| env: | ||
| luisAuthoringRegion: ${{ secrets.luisAuthoringRegion }} | ||
| luisAuthoringKey: ${{ secrets.luisAuthoringKey }} | ||
| ``` | ||
|
|
||
| More about the command [here](https://github.com/microsoft/NLU.DevOps/blob/master/docs/Train.md). | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ... about the |
||
| Before you push to the repo, you need to add credentials (at least luisAuthoringKey and luisAuthoringRegion are required) to your GitHub Secrets. For example, | ||
|  | ||
|
|
||
| Check out the [LUIS docs](https://docs.microsoft.com/en-us/azure/cognitive-services/luis/luis-how-to-azure-subscription) for more information on where to find your authoring or runtime keys. | ||
|
|
||
| 2. To test LUIS model let's use [utterancesTest.json](../models/utterancesTest.json) file. | ||
in4margaret marked this conversation as resolved.
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Create sub-section header for testing |
||
| We can save the result in results.json. During the training step, we may have created a new LUIS application. By using the `--save-appsettings` flag, the LUIS application ID is stored locally in a settings file that is picked up by subsequent NLU.DevOps CLI commands. | ||
|
|
||
| Yaml may look like that: | ||
in4margaret marked this conversation as resolved.
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| ``` | ||
| - name: Test Luis model | ||
| run: dotnet nlu test -s luis -u utterancesTest.json -o results.json | ||
| env: | ||
| luisAuthoringRegion: ${{ secrets.luisAuthoringRegion }} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We may want to discuss that NLU.DevOps will attempt to use your authoring key, but this is limited. Add details that you can also specify the |
||
| luisAuthoringKey: ${{ secrets.luisAuthoringKey }} | ||
| ``` | ||
| 3. We use the `compare` command from the NLU.DevOps CLI to evaluate the results. The expected intents and entities in this case are given in the `utterancesTest.json` file, while the results predicted by the LUIS model are in the `results.json` file. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Section heading for comparing the model. |
||
|
|
||
| ``` | ||
| - name: Compare Luis model | ||
| run: dotnet nlu compare -e utterancesTest.json -a results.json | ||
| ``` | ||
|
|
||
| If you open your GitHub workflow run step for this command in the console, you can see something similar to | ||
|  | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rather than a screenshot, can we inline the bash output in a code fence? It makes it easier to modify in case we make change the output expectations in the future. Also, we could add the markdown table output for F1 scores as well. |
||
|
|
||
| 4. When you work on several hypotheses, sometimes you need only to get results and you don't want to keep the model. It is possible to delete the model in the same pipeline after you get results. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add section header for cleaning up LUIS app resources. |
||
| ``` | ||
| - name: Delete Luis model | ||
| run: dotnet nlu clean -s luis | ||
| env: | ||
| luisAuthoringRegion: ${{ secrets.luisAuthoringRegion }} | ||
| luisAuthoringKey: ${{ secrets.luisAuthoringKey }} | ||
| ``` | ||
|
|
||
| You can find GitHub Action workflow yaml file [here](../pipelines/.github/workflows/nlugithub.yml). | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move this up to the top of the document and say something like "We have an end-to-end example of the action steps below here" |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| [ | ||
| { | ||
| "text": "start playing music", | ||
| "intent": "PlayMusic" | ||
| }, | ||
| { | ||
| "text": "play music", | ||
| "intent": "PlayMusic" | ||
| }, | ||
| { | ||
| "text": "listen to hip hop", | ||
| "intent": "PlayMusic" | ||
| }, | ||
| { | ||
| "text": "is it cold out", | ||
| "intent": "None" | ||
| }, | ||
| { | ||
| "text": "how many days until Christmas", | ||
| "intent": "None" | ||
| }, | ||
| { | ||
| "text": "what's the weather like", | ||
| "intent": "None" | ||
| } | ||
| ] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tabs are off on the closing |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| name: CINLU | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't worry about moving this to the top-level, we probably should not run the same tests twice. |
||
|
|
||
| on: [pull_request] | ||
|
|
||
| jobs: | ||
| build: | ||
| name: NLU workflow | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v1 | ||
|
|
||
| - name: Setup .NET Core | ||
| uses: actions/setup-dotnet@v1 | ||
| with: | ||
| dotnet-version: 2.2.108 | ||
|
|
||
| - name: Install dotnet-nlu | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| run: dotnet tool install -g dotnet-nlu | ||
|
|
||
| - name: Path | ||
| run: echo "::add-path::$HOME/.dotnet/tools" | ||
|
|
||
| - name: Train Luis model | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| run: dotnet nlu train -s luis -u utterances.json --save-appsettings | ||
| env: | ||
| luisAuthoringRegion: ${{ secrets.luisAuthoringRegion }} | ||
| luisAuthoringKey: ${{ secrets.luisAuthoringKey }} | ||
|
|
||
| - name: Test Luis model | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| run: dotnet nlu test -s luis -u utterancesTest.json -o results.json | ||
| env: | ||
| luisAuthoringRegion: ${{ secrets.luisAuthoringRegion }} | ||
| luisAuthoringKey: ${{ secrets.luisAuthoringKey }} | ||
|
|
||
| - name: Compare Luis model | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Compare Luis model -> Compare LUIS results |
||
| run: dotnet nlu compare -e utterancesTest.json -a results.json | ||
|
|
||
| - name: Archive TestResult | ||
in4margaret marked this conversation as resolved.
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we're not doing anything with the results (downloading them), maybe just remove this for now. |
||
| uses: actions/upload-artifact@v1 | ||
| with: | ||
| name: TestResult | ||
| path: TestResult.xml | ||
|
|
||
| - name: Delete Luis model | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| run: dotnet nlu clean -s luis | ||
| env: | ||
| luisAuthoringRegion: ${{ secrets.luisAuthoringRegion }} | ||
| luisAuthoringKey: ${{ secrets.luisAuthoringKey }} | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like some extra whitespace at the end of the file. |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency, rename to
Configuring LUIS CI/CD with GitHub Actions