Skip to content

Commit

Permalink
Merge pull request #119 from lappis-unb/devel
Browse files Browse the repository at this point in the history
Atualização jupyter notebooks
  • Loading branch information
RochaCarla authored Oct 29, 2019
2 parents 9b7fc95 + 41dfcc1 commit 87ce089
Show file tree
Hide file tree
Showing 15 changed files with 529 additions and 586 deletions.
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ graph.html

### Rasa evaluation ###
.ipynb_checkpoints/
modules/notebooks/intents/confmat.png
modules/notebooks/intents/hist.png
modules/notebooks/intents/models/
modules/notebooks/intents/errors.json
modules/notebooks/intents/results/
modules/notebooks/stories/models/
modules/notebooks/stories/results/
bot/.ipython/
bot/.keras/
bot/.local/
Expand All @@ -18,6 +18,9 @@ bot/results/
### database ###
db/

### Rabbitmq ###
data/

### PyCharm ###
.idea/

Expand Down
7 changes: 4 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,14 @@ build requirements:
- docker:dind
script:
- docker login -u $DOCKERHUB_USER -p $DOCKERHUB_PASSWORD
- cd ./docker/bot
- ./build-base.sh publish
- cd ./docker
- docker build . -f docker/requirements.Dockerfile -t lappis/botrequirements:boilerplate
- docker push lappis/botrequirements:boilerplate
only:
refs:
- master
changes:
- ./docker/bot/requirements.txt
- ./requirements.txt
environment: homolog


Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
current_dir := $(shell pwd)

clean:
sudo docker-compose down

############################## BOILERPLATE ##############################
first-run:
make build
Expand Down Expand Up @@ -40,14 +43,14 @@ run-analytics:
sensible-browser --no-sandbox http://localhost:5601

run-shell:
docker-compose run --service-ports bot make shell
docker-compose run --rm --service-ports bot make shell

run-webchat:
docker-compose run -d --rm --service-ports bot-webchat
sensible-browser --no-sandbox modules/webchat/index.html

run-telegram:
docker-compose run -d --rm --service-ports bot make telegram
docker-compose run -d --rm --service-ports bot_telegram make telegram

run-notebooks:
docker-compose up -d notebooks
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ Após realizar o [tutorial](/docs/setup_telegram.md) de exportação de todas va

**Antes de seguir adiante. Importante:** As variáveis de ambiente são necessárias para o correto funcionamento do bot, por isso não esqueça de exportá-las.

Edite o arquivo **credentials.yml** e descomente as linhas referentes ao telegram:

```sh
telegram:
access_token: ${TELEGRAM_TOKEN}
verify: ${TELEGRAM_BOT_USERNAME}
webhook_url: ${TELEGRAM_WEBHOOK}
```

Se ainda não tiver treinado seu bot execute antes:

```sh
Expand All @@ -87,7 +96,7 @@ Para a visualização dos dados da interação entre o usuário e o chatbot nós
* Para uma **configuração rápida** execute o seguinte comando:

```sh
sudo make buil-analytics
sudo make build-analytics
```

O comando acima só precisa ser executado apenas 1 vez e já vai deixar toda a infra de `analytics` pronta para o uso.
Expand Down
14 changes: 13 additions & 1 deletion bot/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
clean:
rm -rf graph.html results/ models/*

############################## BOT ##############################
# NLU
train-nlu:
rasa train nlu -vv

test-nlu:
rasa test nlu -vv

# CORE
train:
rasa train -vv --out models/

# MENSAGEIROS
shell:
rasa shell -m models/ -vv --endpoints endpoints.yml --port 5004 --cors "*"

Expand All @@ -15,6 +27,6 @@ webchat:
run-api:
rasa run -m models/ -vv --endpoints endpoints.yml --enable-api

############################## ACTIONS ##############################
# ACTIONS
run-actions:
rasa run actions --actions actions -vv
17 changes: 2 additions & 15 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,6 @@ services:
- ./bot/actions:/bot/actions
command: sh -c "make run-actions"

# ============================ Telegram Bot =================================
# Specific Rasa bot integrated with Telegram.
bot-telegram:
build:
context: .
dockerfile: ./docker/bot.Dockerfile
env_file:
- env/bot-telegram.env
ports:
- 5005:5005
depends_on:
- actions
command: sh -c "make telegram"

# ============================ WebChat Bot =================================
# Specific Rasa bot integrated with WebChat.
bot-webchat:
Expand Down Expand Up @@ -133,7 +119,7 @@ services:
- actions
volumes:
- ./bot:/bot
command: sh -c "make run-telegram"
command: sh -c "make telegram"

# =============================== Notebooks =================================
# Rasa lab to enhance hyperparameters.
Expand All @@ -145,6 +131,7 @@ services:
- env/notebooks.env
volumes:
- ./modules/notebooks:/work/notebooks
- ./bot/:/bot/
ports:
- 8888:8888

Expand Down
2 changes: 1 addition & 1 deletion docker/actions.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM botrequirements
COPY ./bot/actions/actions.py /bot/actions/actions.py
COPY ./bot/Makefile /bot/Makefile

WORKDIR bot/
WORKDIR /bot

EXPOSE 5055
HEALTHCHECK --interval=300s --timeout=60s --retries=5 \
Expand Down
21 changes: 0 additions & 21 deletions docker/build-base.sh

This file was deleted.

2 changes: 1 addition & 1 deletion docker/coach.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM botrequirements as coach
FROM botrequirements

WORKDIR /bot

Expand Down
4 changes: 3 additions & 1 deletion docker/notebooks.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
FROM lappis/botrequirements:boilerplate
FROM botrequirements

RUN apt-get update && apt-get install -y graphviz libgraphviz-dev pkg-config

# Pygraphviz depends on package graphviz wich needs to be configurated
# acording to each OS. because of it it's not added to bot.requirements
RUN pip install jupyter pygraphviz==1.5

COPY ./bot /bot

WORKDIR /work/

CMD jupyter-notebook --allow-root --NotebookApp.token='' --ip=0.0.0.0 --NotebookApp.password=''
2 changes: 1 addition & 1 deletion docker/requirements.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.6-slim as botrequirements
FROM python:3.6-slim

RUN apt update && apt install -y gcc make

Expand Down
13 changes: 5 additions & 8 deletions env/notebooks.env
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
COACH_DIR_PATH=../../coach/
COACH_DOMAIN_PATH=../../coach/domain.yml
COACH_NLU_CONFIG_PATH=../../coach/nlu_config.yml
COACH_STORIES_PATH=../../coach/data/stories/
COACH_INTENTS_PATH=../../coach/data/intents/
COACH_MODELS_PATH=/models/
COACH_MODELS_NLU_PATH=/models/nlu/current/
COACH_MODELS_DIALOGUE_PATH=/models/dialogue
DIR_PATH=/bot/
DOMAIN_PATH=/bot/domain.yml
CONFIG_PATH=/bot/config.yml
DATA_PATH=/bot/data/
MODELS_PATH=/bot/models/
Loading

0 comments on commit 87ce089

Please sign in to comment.