Giter Site home page Giter Site logo

bert_descriptors's Introduction

bert_descriptors

BERT's MLM head model exposed as a HTTP service

Example below uses BERT large cased

This service is used by Unsupervised NER

Installation

Setup pytorch environment with/without GPU support using link Multi GPU test

*Make sure to follow conda environment activation instructions. Also tensorflow is not required. So we just neeed to run first.sh, second.sh and third.sh (from 1-4) performing the instructions displayed at end of each step *

Usage

Download a BERT model from Hugginface.

e.g. BERT large cased - pytorch_model.bin,vocab.txt,config.json into current directory

e.g. BERT base cased - pytorch_model.bin,vocab.txt,config.json into current directory

Start server

$ ./run_server.sh

Confirm installation works by

$ wget -O DES "http://127.0.0.1:8087/dummy/0/John flew from entity to Rio De Janiro"

The output DES file should contain

Revision notes

17 Sept 2021

  • Two kinds of descriptor sets are returned now.

    1. Return just the descriptors of the masked position as before (option 0 in GET call)
    2. Return descriptors of masked position as well as for [CLS] position (option 1 in GET call). This is useful for detecting entity type of a term/phrase. For example: Imatinib is a entity
    3. Common descriptors are now used to filter terms that do not convey any entity information in results. This is to maximize entity information in generated output
  • Adaptive casing of input tokens to maximize hit with underlying vocab. This is meaningful for cased models only

  • Full distribution output is turned off by default and needs to be enabled explicitly. The output above is with full distribution option turned on. Current default output

License

MIT License

bert_descriptors's People

Contributors

ajitrajasekharan avatar

Watchers

 avatar  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.