Skip to content

Commit

Permalink
Merge pull request #231 from lappis-unb/v3
Browse files Browse the repository at this point in the history
V3
  • Loading branch information
arthurTemporim committed Oct 15, 2023
2 parents 2c9db7f + 52f98c4 commit 72c1438
Show file tree
Hide file tree
Showing 18 changed files with 596 additions and 423 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7]
python-version: [3.10.13]

steps:
- uses: actions/checkout@v2
Expand All @@ -25,7 +25,8 @@ jobs:
- name: Install dependencies
run: |
cd bot/
pip install flake8 pytest rasa==3.3.0
pip install --upgrade pip
pip install flake8 pytest rasa==3.6.12
if [ -f requirements.txt ]; then make install; fi
- name: Lint with flake8
run: |
Expand All @@ -39,8 +40,12 @@ jobs:
echo "Rasa is installed"
- name: Rasa train
run: |
# Removing endpoints.yml and credentials.yml to this workflow.
rm bot/endpoints.yml
rm bot/credentials.yml
cd bot/
sed -i "s/epochs.*$/epochs: 10/" ./config.yml
# Editing config.yml to train with less time.
sed -i "s/epochs.*$/epochs: 5/" ./config.yml
echo "Changed epochs to 10 to check faster"
make train
echo "Model is saved"
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ bot/results*
bot/train_test_split/
.tensorboard*
.rasa/
*.log

### Rasa X ###
events.db
Expand All @@ -28,6 +29,10 @@ bot/results/

### database ###
db/
alerting/
csv/
plugins/
png/

### PyCharm ###
.idea/
Expand Down
34 changes: 16 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,62 +7,60 @@ CREDENTIALS = credentials.yml
# CLEAR PROJECT
clean:
make down
cd bot/ && make clean
cd bot/ && sudo make clean

down:
docker-compose down

docker compose down

# RUN
init:
make build
make train
make shell
make webchat

logs:
docker-compose logs \
docker compose logs \
-f

build:
docker-compose build \
docker compose build \
--no-cache bot

shell:
docker-compose run \
docker compose run \
--rm \
--service-ports \
bot \
make shell ENDPOINTS=$(ENDPOINTS)

api:
docker-compose run \
docker compose run \
--rm \
--service-ports \
bot \
make api ENDPOINTS=$(ENDPOINTS) CREDENTIALS=$(CREDENTIALS)

actions:
docker-compose run \
docker compose run \
--rm \
--service-ports \
bot \
make actions


webchat:
echo "Executando Bot com Webchat."
docker-compose run \
docker compose run \
-d \
--service-ports \
bot \
make webchat ENDPOINTS=$(ENDPOINTS) CREDENTIALS=$(CREDENTIALS)
docker-compose up \
docker compose up \
-d \
webchat
echo "Acesse o WEBCHAT em: http://localhost:5000"

telegram:
docker-compose run \
docker compose run \
-d \
--rm \
--service-ports \
Expand All @@ -71,29 +69,29 @@ telegram:

# DEVELOPMENT
train:
docker-compose run \
docker compose run \
--rm \
bot \
make train

validate:
docker-compose run \
docker compose run \
--rm bot \
make validate

test:
docker-compose run \
docker compose run \
--rm bot \
make test

test-nlu:
docker-compose run \
docker compose run \
--rm \
bot \
make test-nlu

test-core:
docker-compose run \
docker compose run \
--rm \
bot \
make test-core
Expand Down
4 changes: 2 additions & 2 deletions bot/Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
.PHONY: all clean actions

## FLAGS:
LOG_LEVEL = -v
LOG_LEVEL = -vv
RASA_ENDPOINTS = --endpoints
ENDPOINTS = endpoints.yml
RASA_CREDENTIALS = --credentials
CREDENTIALS = credentials.yml

# CLEAN PROJECT
clean:
rm -rf graph.html \
sudo rm -rf graph.html \
results/ \
models/* \
*.db* \
Expand Down
67 changes: 34 additions & 33 deletions bot/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,40 @@ language: br

# See https://rasa.com/docs/rasa/tuning-your-model for more information.
pipeline:
- name: WhitespaceTokenizer
- name: RegexFeaturizer
- name: LexicalSyntacticFeaturizer
- name: CountVectorsFeaturizer
analyzer: char_wb
min_ngram: 1
max_ngram: 4
- name: DIETClassifier
epochs: 80
model_confidence: softmax
constrain_similarities: True
tensorboard_log_directory: ".tensorboard_diet"
tensorboard_log_level: "epoch"
- name: EntitySynonymMapper
- name: ResponseSelector
model_confidence: softmax
epochs: 100
constrain_similarities: True
- name: FallbackClassifier
threshold: 0.7
ambiguity_threshold: 0.2
- name: WhitespaceTokenizer
- name: RegexFeaturizer
- name: LexicalSyntacticFeaturizer
- name: CountVectorsFeaturizer
analyzer: char_wb
min_ngram: 1
max_ngram: 4
- name: DIETClassifier
epochs: 80
model_confidence: softmax
constrain_similarities: true
tensorboard_log_directory: ".tensorboard_diet"
tensorboard_log_level: "epoch"
- name: EntitySynonymMapper
- name: ResponseSelector
model_confidence: softmax
epochs: 100
constrain_similarities: true
- name: FallbackClassifier
threshold: 0.7
ambiguity_threshold: 0.2

# https://rasa.com/docs/rasa/core/policies/
policies:
- name: MemoizationPolicy
- name: TEDPolicy
max_history: 6
epochs: 60
model_confidence: softmax
tensorboard_log_directory: ".tensorboard_ted"
tensorboard_log_level: "epoch"
constrain_similarities: True
- name: RulePolicy
core_fallback_threshold: 0.7
core_fallback_action_name: "action_default_fallback"
enable_fallback_prediction: True
- name: MemoizationPolicy
- name: TEDPolicy
max_history: 6
epochs: 60
model_confidence: softmax
tensorboard_log_directory: ".tensorboard_ted"
tensorboard_log_level: "epoch"
constrain_similarities: true
- name: RulePolicy
core_fallback_threshold: 0.7
core_fallback_action_name: "action_default_fallback"
enable_fallback_prediction: true
assistant_id: 20230606-041623-synchronic-underpass
Loading

0 comments on commit 72c1438

Please sign in to comment.