1
0
Fork
You've already forked BERT-ML.NET
0
BERT AI Model done in Microsoft's ML.NET. Question and Answering (Q&A) BERT model implementation for ML.NET. An example of BERT model predictions in .NET Core/.NET Standard.
C# 98.8%
Shell 1.2%
Find a file
2021年08月10日 19:31:23 +02:00
.github/workflows Create dotnetcore.yml 2019年11月14日 00:43:36 +01:00
BERT.Console removed toplevel statements 2021年03月20日 14:02:30 +01:00
BERT.WebApi Update ML.NET to 1.5.4 and ONNX Runtime to 1.6.0. Add HTTP GET endpoint. Add ONNX model downloader. 2021年01月08日 04:33:49 -08:00
Microsoft.ML.Models.BERT Update ML.NET to 1.5.4 and ONNX Runtime to 1.6.0. Add HTTP GET endpoint. Add ONNX model downloader. 2021年01月08日 04:33:49 -08:00
.gitignore Added console sample 2021年03月20日 13:06:45 +01:00
BERT ML.sln Added console sample 2021年03月20日 13:06:45 +01:00
getDependicies.sh Update ML.NET to 1.5.4 and ONNX Runtime to 1.6.0. Add HTTP GET endpoint. Add ONNX model downloader. 2021年01月08日 04:33:49 -08:00
LICENSE Update LICENSE 2020年09月07日 19:06:36 +02:00
README.md Update README.md 2021年08月10日 19:31:23 +02:00

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}