Skip to content
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

Add option to specify --fixed-model-name #24

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
rasa-demo
results.json
report_main.json
.history
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
| `data_validate` | Validates domain and data files to check for possible mistakes | `true` |
| `data_validate_args` | Additional arguments passed to the `rasa data validate` command | `none` |
| `fine_tune` | Fine-tune an existing model with new training dataset | `false` |
| `fixed_model_name` | Name of the model file will be set to the given name | `none` |
| `workspace` | The root directory containing your Rasa Open Source project | `${{ github.workspace }}` |
| `train_type` | The types of training (available types: `core`/`nlu`/`all`) | `all` |
| `train_args` | Additional arguments passed to the `rasa train` command | `none` |
Expand Down
20 changes: 19 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ inputs:
description: 'Fine-tune model'
required: false
default: 'false'
fixed_model_name:
description: 'Name to be given to the model file'
required: false
default: ''
data_validate:
description: 'Validates domain and data files to check for possible mistakes'
required: true
Expand Down Expand Up @@ -159,6 +163,11 @@ runs:
echo MODEL_ARGS="--model /app/${{ inputs.model }}" >> $GITHUB_ENV
fi

# Set a fixed model name
if [[ -n "${{ inputs.fixed_model_name }}" ]];then
echo FIXED_MODEL_ARGS="--fixed-model-name ${{ inputs.fixed_model_name }}" >> $GITHUB_ENV
fi

# Set cross validation
if [[ "${{ inputs.cross_validation }}" == "true" ]];then
echo CROSS_VALIDATION_ARGS="--cross-validation" >> $GITHUB_ENV
Expand Down Expand Up @@ -240,7 +249,7 @@ runs:
elif [[ "${{ inputs.rasa_train }}" == "true" ]]; then
echo "Run the rasa train"
echo ""
docker run ${{ env.DOCKER_ARGS }} ${{ env.RASA_IMAGE }} train ${{ env.TRAIN_TYPE }} ${{ env.DEFAULT_ARGS }} ${{ env.FINE_TUNE }} ${{ inputs.train_args }}
docker run ${{ env.DOCKER_ARGS }} ${{ env.RASA_IMAGE }} train ${{ env.TRAIN_TYPE }} ${{ env.DEFAULT_ARGS }} ${{ env.FIXED_MODEL_ARGS }} ${{ env.FINE_TUNE }} ${{ inputs.train_args }}
else
echo "::warning::rasa train is disabled. To turn on the rasa train set the rasa_train parameter to 'true'."
fi
Expand Down Expand Up @@ -302,6 +311,15 @@ runs:
OUTPUT="${OUTPUT}\n$(python3 ${{ github.action_path }}/scripts/cross_validation_results.py)"
fi

if [[ -f "${{ inputs.workspace }}/${{ inputs.result_directory }}/failed_test_stories.yml" ]]; then
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably based this PR on your other PR. These should be applicable separately.

TEST_FAILED=$(grep 'None of the test stories failed' README.md > /dev/null; echo $?)
if [[ $TEST_FAILED -eq 0 ]]; then
OUTPUT="${OUTPUT}\n```yml\n$(cat ${{ inputs.workspace }}/${{ inputs.result_directory }}/failed_test_stories.yml)```"
else
OUTPUT="${OUTPUT}\n\n#$(cat ${{ inputs.workspace }}/${{ inputs.result_directory }}/failed_test_stories.yml)"
fi
fi

OUTPUT="${OUTPUT//$'\n'/'\n'}"

curl -X POST -s -H "Authorization: token ${{ inputs.github_token }}" -H "Accept: application/vnd.github.v3+json" \
Expand Down
1 change: 1 addition & 0 deletions scripts/cross_validation_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def entity_table():
cols = ["support", "f1-score", "precision", "recall"]
writer.headers = ["entity"] + cols

data.pop("accuracy", None)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

classes = list(data.keys())
classes.sort(key=lambda x: data[x]["support"], reverse=True)

Expand Down