Code Monkey home page Code Monkey logo

chinese-qa-chatbot's Introduction

Trouble Netizen

A simple chinese QA chatbot implement with pytorch and transformer trained by PTT data
簡易 ptt gossiping QA chatbot 使用 pytorch framework 和 transformers

Tutorial:
https://github.com/1tangerine1day/bert2bert_QA_chatbot/blob/master/QA_chatbot_step_by_step.ipynb

Demo for using:
https://github.com/1tangerine1day/bert2bert_QA_chatbot/blob/master/How_to_use.ipynb

Model:

picture from this
Instead of AraBERT, I use normal bert with pretrain model "bert-base-chinese"

Data:
https://github.com/zake7749/Gossiping-Chinese-Corpus

My trained weight (best.pt):
https://drive.google.com/file/d/1qc5uq5_Uag1XROoxbpruWZGzR3bhTyT-/view?usp=sharing

Training

  • batch: 50
  • learning rate: 1e-5
  • optimizer: Adam
  • epochs: 20

load model

from bert2bert import QA_chatbot

cahtbot = QA_chatbot()
cahtbot.load_model("best.pt")

predict

test case 1 (恩...健康 = 股價)

cahtbot.predict("加權指數狂跌小台卻狂拉")
'台灣人的健康就是這樣'


test case 2 (有點兇 XD)

cahtbot.predict("校園霸凌嚴重 立委兒子生殖器被踹到流血")
',這種人真的很可憐,不要出來丟人現眼'


test case 3 (竟然有接到!)

cahtbot.predict("cosplay機師有什麼搞頭嗎?")
'我想看看'


test case 4 (某種雙關?)

cahtbot.predict("工程師月薪多少")
',台灣的公司薪水不是一般人的一般人的薪'

chinese-qa-chatbot's People

Contributors

1tangerine1day avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

jackjou0920

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.