Skip to content

Commit

Permalink
Merge branch 'main' into nlu_endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
indam23 authored Jan 26, 2021
2 parents 967b330 + 30dae89 commit 1b19bb2
Show file tree
Hide file tree
Showing 60 changed files with 3,289 additions and 2,175 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ docs
**/*.pyc
**/__pycache__
!docker/configs
rasa/tests
rasa/scripts
data/
examples/
4 changes: 3 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
* -text
* -text
# Reclassifies `Dockerfile*` files as Dockerfile:
Dockerfile.* linguist-language=Dockerfile
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ Or might there be any potential blockers on the way? -->
<!-- What needs to be there to consider this feature as done?
- [ ] Tests are added
- [ ] Feature described the docs
- [ ] Feature mentioned in the changlog
- [ ] Feature mentioned in the changelog
- [ ] ... -->
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
**Status (please check what you already did)**:
- [ ] added some tests for the functionality
- [ ] updated the documentation
- [ ] updated the changelog (please check [changelog](https://github.com/RasaHQ/rasa/tree/master/changelog) for instructions)
- [ ] updated the changelog (please check [changelog](https://github.com/RasaHQ/rasa/tree/main/changelog) for instructions)
- [ ] reformat files using `black` (please check [Readme](https://github.com/RasaHQ/rasa#code-style) for instructions)
2 changes: 1 addition & 1 deletion .github/configs/mr-test-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
## - dataset: ["Hermit"]
## config: ["Sparse + DIET(seq) + ResponseSelector(t2t)", "BERT + DIET(seq) + ResponseSelector(t2t)"]
#
## Example: Define a branch name to check-out for a dataset repository. Default branch is 'master'
## Example: Define a branch name to check-out for a dataset repository. Default branch is 'main'
## dataset_branch: "test-branch"
## include:
## - dataset: ["Carbon Bot", "Sara"]
Expand Down
4 changes: 2 additions & 2 deletions .github/templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ The template reads a file with a report (the report file is available as an arti
#### How to run locally

```shell
gomplate -d data=report.json -d results_master=report_master.json -f .github/templates/model_regression_test_results.tmpl
gomplate -d data=report.json -d results_main=report_main.json -f .github/templates/model_regression_test_results.tmpl
```

In order to be able to use the `.github/templates/model_regression_test_results.tmpl` template you need the following files:

- `report.json` - the file with a report generated by the `CI - Model Regression` workflow run in a PR. The report is available to download as an artifact in the workflow related to the PR.
- `report_master.json` - the file with a report generated by the `CI - Model Regression` workflow that is triggered on schedule event. A list of the workflows that you can download an artifact from, can be found [here](https://github.com/RasaHQ/rasa/actions?query=workflow%3A%22CI+-+Model+Regression%22+event%3Aschedule).
- `report_main.json` - the file with a report generated by the `CI - Model Regression` workflow that is triggered on schedule event. A list of the workflows that you can download an artifact from, can be found [here](https://github.com/RasaHQ/rasa/actions?query=workflow%3A%22CI+-+Model+Regression%22+event%3Aschedule).
4 changes: 2 additions & 2 deletions .github/templates/model_regression_test_config_to_json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ The template reads an issue/a PR comment and transforms a YAML code block into J

*/ -}}
{{- $config := ((datasource "github").body | regexp.Find "```(?s)(.*)```" | regexp.ReplaceLiteral "```.*|\r" "" | yaml | toJSON | json) -}}
{{- $dataset_branch := "master" -}}
{{- /* if a branch name for dataset repository is not defined use the master branch */ -}}
{{- $dataset_branch := "main" -}}
{{- /* if a branch name for dataset repository is not defined use the main branch */ -}}
{{- if has $config "dataset_branch" -}}
{{- $dataset_branch = $config.dataset_branch -}}
{{- end -}}
Expand Down
44 changes: 22 additions & 22 deletions .github/templates/model_regression_test_results.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ The print_result template returns data depends on available fields.

*/ -}}
{{ define "print_result" -}}
{{- if and (has (index .branch "micro avg") "f1-score") (has (index .master "micro avg") "f1-score") -}}
{{ printf "%.4f" (index (index .branch "micro avg") "f1-score") }} ({{ printf "%.2f" ((index (index .master "micro avg") "f1-score") | math.Sub (index (index .branch "micro avg") "f1-score")) }})
{{- else if and (has .branch "accuracy") (has .master "accuracy") -}}
{{ printf "%.4f" .branch.accuracy }} ({{ printf "%.2f" (.master.accuracy | math.Sub .branch.accuracy) }})
{{- else if and (has .branch "accuracy") (has (index .master "micro avg") "f1-score") -}}
{{ printf "%.4f" .branch.accuracy }} ({{ printf "%.2f" ((index (index .master "micro avg") "f1-score") | math.Sub .branch.accuracy) }})
{{- else if and (has (index .branch "micro avg") "f1-score") (has .master "accuracy") -}}
{{ printf "%.4f" (index (index .branch "micro avg") "f1-score") }} ({{ printf "%.2f" (.master.accuracy | math.Sub (index (index .branch "micro avg") "f1-score")) }})
{{- if and (has (index .branch "micro avg") "f1-score") (has (index .main "micro avg") "f1-score") -}}
{{ printf "%.4f" (index (index .branch "micro avg") "f1-score") }} ({{ printf "%.2f" ((index (index .main "micro avg") "f1-score") | math.Sub (index (index .branch "micro avg") "f1-score")) }})
{{- else if and (has .branch "accuracy") (has .main "accuracy") -}}
{{ printf "%.4f" .branch.accuracy }} ({{ printf "%.2f" (.main.accuracy | math.Sub .branch.accuracy) }})
{{- else if and (has .branch "accuracy") (has (index .main "micro avg") "f1-score") -}}
{{ printf "%.4f" .branch.accuracy }} ({{ printf "%.2f" ((index (index .main "micro avg") "f1-score") | math.Sub .branch.accuracy) }})
{{- else if and (has (index .branch "micro avg") "f1-score") (has .main "accuracy") -}}
{{ printf "%.4f" (index (index .branch "micro avg") "f1-score") }} ({{ printf "%.2f" (.main.accuracy | math.Sub (index (index .branch "micro avg") "f1-score")) }})
{{- else if (has .branch "accuracy") -}}
{{ printf "%.4f" .branch.accuracy }} (`no data`)
{{- else if has (index .branch "micro avg") "f1-score" -}}
Expand All @@ -28,9 +28,9 @@ The print_result template returns data depends on available fields.
{{- end -}}
{{- end -}}

{{- $results_master := (datasource "results_master") -}}
{{- $results_main := (datasource "results_main") -}}
{{ range $dataset, $config := (datasource "data")}}
{{- $dataset_master := (index $results_master $dataset) -}}
{{- $dataset_main := (index $results_main $dataset) -}}
Dataset: `{{$dataset}}`, Dataset repository branch: `{{ (index $config (index (keys $config) 0)).dataset_repository_branch }}`

| Configuration | Intent Classification Micro F1 | Entity Recognition Micro F1 | Response Selection Micro F1 |
Expand All @@ -39,34 +39,34 @@ Dataset: `{{$dataset}}`, Dataset repository branch: `{{ (index $config (index (k
| `{{ $config_name }}`<br> test: `{{ $config_data.test_run_time }}`, train: `{{ $config_data.train_run_time }}`, total: `{{ $config_data.total_run_time }}`|
{{- if has $config_data "intent_classification" -}}
{{- /* Use results from branch if there is lack of data doesn't exist in results from scheduled version */ -}}
{{- $intent_class_master := $config_data.intent_classification -}}
{{- if has $dataset_master $config_name -}}
{{- $intent_class_master = (index $dataset_master $config_name).intent_classification -}}
{{- $intent_class_main := $config_data.intent_classification -}}
{{- if has $dataset_main $config_name -}}
{{- $intent_class_main = (index $dataset_main $config_name).intent_classification -}}
{{- end -}}
{{- $intent_class := index $config_data.intent_classification -}}
{{ template "print_result" (dict "branch" $intent_class "master" $intent_class_master) }}|
{{ template "print_result" (dict "branch" $intent_class "main" $intent_class_main) }}|
{{- else -}}
`no data`|
{{- end -}}
{{- if has $config_data "entity_prediction" -}}
{{- /* Use results from branch if there is lack of data doesn't exist in results from scheduled version */ -}}
{{- $entity_class_master := index $config_data.entity_prediction -}}
{{- if has $dataset_master $config_name -}}
{{- $entity_class_master = (index $dataset_master $config_name).entity_prediction -}}
{{- $entity_class_main := index $config_data.entity_prediction -}}
{{- if has $dataset_main $config_name -}}
{{- $entity_class_main = (index $dataset_main $config_name).entity_prediction -}}
{{- end -}}
{{- $entity_class := $config_data.entity_prediction -}}
{{ template "print_result" (dict "branch" $entity_class "master" $entity_class_master) }}|
{{ template "print_result" (dict "branch" $entity_class "main" $entity_class_main) }}|
{{- else -}}
`no data`|
{{- end -}}
{{- if has $config_data "response_selection" -}}
{{- /* Use results from branch if there is lack of data doesn't exist in results from scheduled version */ -}}
{{- $response_class_master := index $config_data.response_selection -}}
{{- if has $dataset_master $config_name -}}
{{- $response_class_master = (index $dataset_master $config_name).response_selection -}}
{{- $response_class_main := index $config_data.response_selection -}}
{{- if has $dataset_main $config_name -}}
{{- $response_class_main = (index $dataset_main $config_name).response_selection -}}
{{- end -}}
{{- $response_class := $config_data.response_selection -}}
{{ template "print_result" (dict "branch" $response_class "master" $response_class_master) }}|
{{ template "print_result" (dict "branch" $response_class "main" $response_class_main) }}|
{{- else -}}
`no data`|
{{- end }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci-model-regression-on-schedule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout master
- name: Checkout main
uses: actions/checkout@v2

- name: Download yq
Expand Down Expand Up @@ -150,7 +150,7 @@ jobs:
if: steps.set_dataset_config_vars.outputs.is_dataset_exists == 'true' && steps.set_dataset_config_vars.outputs.is_config_exists == 'true'
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ env.POETRY_VERSION }}-3.8-${{ hashFiles('**/poetry.lock') }}
key: ${{ runner.os }}-poetry-${{ env.POETRY_VERSION }}-3.8-${{ hashFiles('**/poetry.lock') }}-${{ secrets.POETRY_CACHE_VERSION }}

- name: Install Dependencies 📦
if: steps.set_dataset_config_vars.outputs.is_dataset_exists == 'true' && steps.set_dataset_config_vars.outputs.is_config_exists == 'true'
Expand Down Expand Up @@ -206,7 +206,7 @@ jobs:
TRAIN_RUN_TIME: ${{ steps.run_test.outputs.train_run_time }}
TOTAL_RUN_TIME: ${{ steps.run_test.outputs.total_run_time }}
PR_URL: ""
DATASET_REPOSITORY_BRANCH: "master"
DATASET_REPOSITORY_BRANCH: "main"
run: |-
poetry run pip install analytics-python
poetry run python .github/scripts/mr_publish_results.py
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/ci-model-regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
cleanup_runs:
name: Cancel old branch builds
runs-on: ubuntu-latest
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master'"
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'"

steps:
- name: Find and cancel old builds of this branch
Expand All @@ -35,7 +35,7 @@ jobs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
configuration_id: ${{ steps.fc_config.outputs.comment-id }}
steps:
- name: Checkout master
- name: Checkout main
uses: actions/checkout@v2

- name: Checkout dataset
Expand Down Expand Up @@ -244,7 +244,7 @@ jobs:
if: steps.set_dataset_config_vars.outputs.is_dataset_exists == 'true' && steps.set_dataset_config_vars.outputs.is_config_exists == 'true'
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ env.POETRY_VERSION }}-3.8-${{ hashFiles('**/poetry.lock') }}
key: ${{ runner.os }}-poetry-${{ env.POETRY_VERSION }}-3.8-${{ hashFiles('**/poetry.lock') }}-${{ secrets.POETRY_CACHE_VERSION }}

- name: Install Dependencies 📦
if: steps.set_dataset_config_vars.outputs.is_dataset_exists == 'true' && steps.set_dataset_config_vars.outputs.is_config_exists == 'true'
Expand Down Expand Up @@ -391,7 +391,7 @@ jobs:
if: steps.set_dataset_config_vars.outputs.is_dataset_exists == 'true' && steps.set_dataset_config_vars.outputs.is_config_exists == 'true'
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ env.POETRY_VERSION }}-3.8-${{ hashFiles('**/poetry.lock') }}
key: ${{ runner.os }}-poetry-${{ env.POETRY_VERSION }}-3.8-${{ hashFiles('**/poetry.lock') }}-${{ secrets.POETRY_CACHE_VERSION }}

- name: Install Dependencies 📦
if: steps.set_dataset_config_vars.outputs.is_dataset_exists == 'true' && steps.set_dataset_config_vars.outputs.is_config_exists == 'true'
Expand Down Expand Up @@ -474,7 +474,7 @@ jobs:
| jq -r '.workflows[] | select(.name == "${{ github.workflow }}") | select(.path | test("schedule")) | .id')
ARTIFACT_URL=$(curl -s -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' -H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/actions/workflows/${SCHEDULE_ID}/runs?event=schedule&status=completed&branch=master&per_page=1" | jq -r .workflow_runs[0].artifacts_url)
"https://api.github.com/repos/${{ github.repository }}/actions/workflows/${SCHEDULE_ID}/runs?event=schedule&status=completed&branch=main&per_page=1" | jq -r .workflow_runs[0].artifacts_url)
DOWNLOAD_URL=$(curl -s -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' -H "Accept: application/vnd.github.v3+json" "${ARTIFACT_URL}" \
| jq -r '.artifacts[] | select(.name="report.json") | .archive_download_url')
Expand All @@ -483,7 +483,7 @@ jobs:
curl -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' -LJO -H "Accept: application/vnd.github.v3+json" $DOWNLOAD_URL
# Unzip and change name
unzip report.json.zip && mv report.json report_master.json
unzip report.json.zip && mv report.json report_main.json
- name: Download the report
uses: actions/download-artifact@v2
Expand All @@ -498,7 +498,7 @@ jobs:
- name: Render a comment to add
id: get_results
run: |
OUTPUT="$(gomplate -d data=report.json -d results_master=report_master.json -f .github/templates/model_regression_test_results.tmpl)"
OUTPUT="$(gomplate -d data=report.json -d results_main=report_main.json -f .github/templates/model_regression_test_results.tmpl)"
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
echo "::set-output name=result::$OUTPUT"
Expand Down Expand Up @@ -550,7 +550,7 @@ jobs:
| jq -r '.workflows[] | select(.name == "${{ github.workflow }}") | select(.path | test("schedule")) | .id')
ARTIFACT_URL=$(curl -s -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' -H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/actions/workflows/${SCHEDULE_ID}/runs?event=schedule&status=completed&branch=master&per_page=1" | jq -r .workflow_runs[0].artifacts_url)
"https://api.github.com/repos/${{ github.repository }}/actions/workflows/${SCHEDULE_ID}/runs?event=schedule&status=completed&branch=main&per_page=1" | jq -r .workflow_runs[0].artifacts_url)
DOWNLOAD_URL=$(curl -s -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' -H "Accept: application/vnd.github.v3+json" "${ARTIFACT_URL}" \
| jq -r '.artifacts[] | select(.name="report.json") | .archive_download_url')
Expand All @@ -559,7 +559,7 @@ jobs:
curl -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' -LJO -H "Accept: application/vnd.github.v3+json" $DOWNLOAD_URL
# Unzip and change name
unzip report.json.zip && mv report.json report_master.json
unzip report.json.zip && mv report.json report_main.json
- name: Download the report
uses: actions/download-artifact@v2
Expand All @@ -574,7 +574,7 @@ jobs:
- name: Render a comment to add
id: get_results
run: |
OUTPUT="$(gomplate -d data=report.json -d results_master=report_master.json -f .github/templates/model_regression_test_results.tmpl)"
OUTPUT="$(gomplate -d data=report.json -d results_main=report_main.json -f .github/templates/model_regression_test_results.tmpl)"
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
echo "::set-output name=result::$OUTPUT"
Expand Down
Loading

0 comments on commit 1b19bb2

Please sign in to comment.