Coder Social home page Coder Social logo

bert-ml.net's Introduction

BERT-ML.NET

Question and Answering (Q&A) BERT model implementation for ML.NET.

An example of BERT model predictions in .NET Core/.NET Standard.

Model

https://github.com/onnx/models/tree/master/text/machine_comprehension/bert-squad

Download the pre-trained BERT ONNX model by running getDependicies.sh. Or download the model to the BERT.WebApi/Model folder.

GPU usage

The project is setup to run on CPU. This allows the sample to run on machines without an Nvidia GPU.

To run on an Nvidia CUDA GPU:

  • Set hasGpu = true in OnnxModelConfigurator.cs
  • Remove NuGet Microsoft.ML.OnnxRuntime.NoOpenMP
  • Add NuGet Microsoft.ML.OnnxRuntime.Gpu

Example queries

When the solution runs, it will start an ASP.NET webservice at localhost:5001.

Context Question Model Reply
(link) Bob is walking through the woods collecting blueberries and strawberries to make a pie. What is his name? {"tokens":["bob"],"probability":0.8884454}
(link) Bob is walking through the woods collecting blueberries and strawberries to make a pie. What will he bring home? {"tokens":["blueberries","and","strawberries"],"probability":0.4070111}
(link) Bob is walking through the woods collecting blueberries and strawberries to make a pie. Where is Bob? {"tokens":["walking","through","the","woods"],"probability":0.6123137}
(link) Bob is walking through the woods collecting blueberries and strawberries to make a pie. What will he bake? {"tokens":["blueberries","and","strawberries"],"probability":0.48385787}

bert-ml.net's People

Contributors

gigabyte0x1337 avatar justinormont avatar gerjanvl 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.