Git Product home page Git Product logo

chatbot_api's Introduction

Simple Chatbot based on KoGPT2

Run on Ainize
스크린샷 2021-05-12 오후 3 02 46

Purpose

  • jupyter notebook처럼 GPU 환경은 유지하되 Streamlit을 이용하여 심심이와 훨씬 직관적인 대화를 할 수 있습니다.
  • 공개된 한글 챗봇 데이터와 pre-trained KoGPT2를 이용한 간단한 챗봇 실험
  • KoGPT2의 다양한 활용 가능성을 타진하고 성능을 정성적으로 평가한다.

Architecture

학습 데이터에 적합하게 Hello! GPT-2를 응용, 아래와 같은 아키텍처를 설계함

drawing

  • 데이터의 Q 필드를 <usr>발화, A 필드를 <sys>발화 그리고 감정 레이블을 <sent>로 매핑해 P(<sys>|<usr>, <sent>)를 최대화 할 수 있는 모델을 학습한다. 감정 레이블은 이곳의 정의를 따른다(일상다반사 0, 이별(부정) 1, 사랑(긍정) 2).

Install

git clone --recurse-submodules https://github.com/haven-jeon/KoGPT2-chatbot.git
cd KoGPT2-chatbot
pip3 install -r requirements.txt 

How to Train

CUDA_VISIBLE_DEVICES=0 python train_torch.py --gpus 1 --train --max_epochs 2

How to Chat!

# CUDA_VISIBLE_DEVICES=0 python train.py --chat
CUDA_VISIBLE_DEVICES=0 python train_torch.py --gpus 1 --chat
user > 대박 
Simsimi > 잘 될 거예요.

user > 너 이름이 뭐니?
Simsimi > 저는 위로봇입니다.

user > 어버이날엔 뭘 하죠?
Simsimi > 저랑 놀아요.

user > 비가와
Simsimi > 우산 챙기세요.

user > 눈이와
Simsimi > 눈사람 만들어보세요.

user > 천둥이 쳐
Simsimi > 저도 보고 싶어요.

user > 봄이왔어.
Simsimi > 봄은 항상 두근거려요.

user > 배탈났어.
Simsimi > 얼른 집에 가서 쉬세요.

user > 너를 만든 사람은?
Simsimi > 당신이 만든 사람이에요.

Colab tutorials

  • PyTorch
    • Open In Colab

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.