Neural Machine Chatbot using seq2seq
Clone or download

Neural Chatbot

Neural Network Chatbot from Google's Neural Machine Translation

Using seq2seq(RNN) 

Training (django Version)

  • Download Source to $PROJECT
    git clone
  • Install MeCab (한글 형태소 분석용)
    bash <(curl -s
  • Install requirements
    cd NM-chatbot
    pip install -r requirements.txt    
  • Make migration
    python migrate
  • Create Super User for admin (id/password)
    python createsuperuser
  • Make initial data
    python makedata --initial
  • Run Server
    python runserver
    python makedata

Training (Console Version)

  • Make training data
    mkdir -p /tmp/nmt_chat

Just example!

make traing data for requesting

    echo -e "안녕?\n넌 누구니?\n잘 지내?" > train.req

make traing data for replying

    echo -e "안녕!\n난 코에이?\n응 잘 지내" > train.rep

make test data for requesting

    echo -e "안녕?\n넌 누구니?" > test.req

make test data for replying

    echo -e "안녕!\n난 코에이" > test.rep

make vocab file for training. train.all means a merged file from train.req & train.rep

    python $PROJECT_ROOT/core/bin/ < train.all > vocab.req
    cp vocab.req vocab.rep

copy all file to '/tmp/nmt_chat'

    cp train.req train.rep test.req test.rep vocab.req vocab.rep /tmp/nmt_chat
  • Do training

    Go to Project's ROOT directory and run training

python -m core.nmt \
    --attention=scaled_luong \
    --src=req --tgt=rep \
    --vocab_prefix=/tmp/nmt_chat/vocab  \
    --train_prefix=/tmp/nmt_chat/train \
    --dev_prefix=/tmp/nmt_chat/test  \
    --test_prefix=/tmp/nmt_chat/test \
        --out_dir=/tmp/chat_model \
    --num_train_steps=12000 \
    --steps_per_stats=100 \
    --num_layers=4 \
    --num_units=128 \
    --dropout=0.2 \
  • Test chatbot

    Go to Project's ROOT directory and edit for out_dir and run

python runserver

check http://localhost:8000

한글 설명