Code Monkey home page Code Monkey logo

korean_chatbot_model's Introduction

seq2seq로 구현한 한국어 일상대화 챗봇 모델

- Preprocessing

  • tokenize: 단어(띄어쓰기) 단위
  • text normalize
    • '?', '!', '.' 를 제외한 특수기호 제거
  • SOS, EOS, UNK, PAD 특수토큰 사용
    • 모르는 단어가 들어왔을 시 UNK 로 처리
    • 가장 긴 길이의 발화보다 짧은 발화는 PAD 로 zeropadding 처리

- Model Architecture

  • embedding

    • torch.nn.Embedding layer 사용
    • 임베딩 차원: 학습한 데이터에 있는 단어 개수 (8700개)
  • encoder

    • torch.nn.GRU layer 사용
    • hidden_layer = 2
    • dropout = 0.5
  • decoder

    • attention layer 사용
    • hidden_layer = 2
    • dropout = 0.5
    • softmax 값으로 출력
  • loss function

    • maskNLL(Negative Log Likelihood) Loss 사용 - batch별로 다른 길이의 input 처리
  • training

    • SGD(mini-batch)
      • batch_size = 64
    • gradient clipping
    • random teacher forcing
      • teacher forcing 하지 않을 경우 greedy decoding
    • train_iteration = 4000
  • max_length = 20

    • 출력 발화 길이 제한

- Requirements

  1 pandas
  2 re
  3 torch
  4 random
  5 os
  6 sys
  7 tqdm

Testing Chatbot

  • 실행

    $ python3 model.py
    > [input]
  • 종료

    quit 혹은 q 입력 시 종료

    $ python3 model.py
    > [input]
    Bot: [output]
    > quit
  • 실행 예시

image

korean_chatbot_model's People

Contributors

jyujin39 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.