Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Gigabyte0x1337/BERT-ML.NET
BERT Model for dotnet ML
https://github.com/Gigabyte0x1337/BERT-ML.NET
api bert-model dotnet ml
Last synced: 5 days ago
JSON representation
BERT Model for dotnet ML
- Host: GitHub
- URL: https://github.com/Gigabyte0x1337/BERT-ML.NET
- Owner: Gigabyte0x1337
- License: mit
- Created: 2019-09-10T20:21:02.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-08-10T17:31:23.000Z (over 3 years ago)
- Last Synced: 2023-03-06T05:48:12.404Z (over 1 year ago)
- Topics: api, bert-model, dotnet, ml
- Language: C#
- Homepage:
- Size: 177 KB
- Stars: 70
- Watchers: 5
- Forks: 12
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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-squadDownload the pre-trained BERT ONNX model by running `getDependicies.sh`. Or download the [model](https://github.com/onnx/models/blob/master/text/machine_comprehension/bert-squad/model/bertsquad-10.onnx?raw=true) 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](https://localhost:5001/api/predict?Context=Bob%20is%20walking%20through%20the%20woods%20collecting%20blueberries%20and%20strawberries%20to%20make%20a%20pie.&Question=What%20is%20his%20name?)) | Bob is walking through the woods collecting blueberries and strawberries to make a pie. | What is his name? | ✅ `{"tokens":["bob"],"probability":0.8884454}` |
| ([link](https://localhost:5001/api/predict?Context=Bob%20is%20walking%20through%20the%20woods%20collecting%20blueberries%20and%20strawberries%20to%20make%20a%20pie.&Question=What%20will%20he%20bring%20home?)) | 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](https://localhost:5001/api/predict?Context=Bob%20is%20walking%20through%20the%20woods%20collecting%20blueberries%20and%20strawberries%20to%20make%20a%20pie.&Question=Where%20is%20bob?)) | 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](https://localhost:5001/api/predict?Context=Bob%20is%20walking%20through%20the%20woods%20collecting%20blueberries%20and%20strawberries%20to%20make%20a%20pie.&Question=What%20will%20he%20bake?)) | 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}` |