Coder Social home page Coder Social logo

bert-question-answer's Introduction

BERT QA

  • 基於BERT的問答模組
  • 自動滑窗,允許超長文本輸入

Usage

  • 安裝相依套件: pip install -r requirements.txt
  • release下載預訓練模型
  • 詳細用法見example.py
# init BertQA
bertQA = BertQA(model = model, tokenizer = tokenizer, device = device)
context="大同國小有三個職員,王大明是校長,張小美是秘書,陳小玉是總務長"

question = "誰是校長"
answer_results = bertQA.ask(context,question)
# score:2.17795 start_index:11(1.07034) end_index:13(1.10761) answer:王大明

question = "陳小玉的工作是什麼"
answer_results = bertQA.ask(context,question)
# score:2.07151 start_index:29(1.84568) end_index:31(0.22583) answer:總務長

Usage

  1. 確保已經安裝pytorch1.4+
  2. 安裝相依套件: pip install -r requirements.txt
  3. release下載預訓練模型
  4. 將下載的模型放到trained_model/
  5. 詳細用法見example.py

bert-question-answer's People

Contributors

p208p2002 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

bert-question-answer's Issues

請教您關於fine tune的問題

大大,請問一下,我沒有看到您的程式當中有fine tune的程式碼,只有看到您把資料傳到模型裡面,並不理解這過程當中是如何fine-tune的,可否告知,感謝。

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.