gigabyte0x1337 / bert-ml.net Goto Github PK
View Code? Open in Web Editor NEWBERT Model for dotnet ML
License: MIT License
BERT Model for dotnet ML
License: MIT License
@gerjanvl @justinormont @GerjanVlot I want to run just C# wrapper using dll files because system only accepts c# wrapper and we can't run localserver in our system..
So how can I run just C# script to predict answers from given question without using web apis?
Please help me in this..
Thanks
Hi !
Thank you for the project. It was a great help. Is it possible to create examples for the NER model?
@gerjanvl @GerjanVlot After downloading pretrained model to desired location , what command should I follow to run local server on ASP.NET?
Thanks
In the current implementation we load the model from a file: bertsquad-10.onnx
By some reasons I'd like to upload this file to a database (SQL Server) and load it from the database.
Is it possible to do it?
For example, I want to move your code to SQLCLR function. It is impossible to work with file in a common case.
And the best way is to load vocabulary and model from a database.
Take a look at
"Question and Answering (Q&A) BERT model implimentation for ML.NET." <- implementation
So, I updated this project (complete solution) to dotnet 6.0... The WebApi works, but the ConsoleApplication fails out with this error code:
/BERT-ML.NET-master/BERT.Console/bin/Debug/net6.0/BERT.Console "Bob is walking through the woods collecting blueberries and strawberries to make a pie." "What is his name?"
Unhandled exception. System.InvalidOperationException: Error initializing model :Microsoft.ML.OnnxRuntime.OnnxRuntimeException: [ErrorCode:InvalidProtobuf] Load model from Model/bertsquad-10.onnx failed:Protobuf parsing failed.
at Microsoft.ML.OnnxRuntime.NativeApiStatus.VerifySuccess(IntPtr nativeStatus)
at Microsoft.ML.OnnxRuntime.InferenceSession.Init(String modelPath, SessionOptions options, PrePackedWeightsContainer prepackedWeightsContainer)
at Microsoft.ML.OnnxRuntime.InferenceSession..ctor(String modelPath, SessionOptions options)
at Microsoft.ML.Transforms.Onnx.OnnxModel..ctor(String modelFile, Nullable`1 gpuDeviceId, Boolean fallbackToCpu, Boolean ownModelFile, IDictionary`2 shapeDictionary, Int32 recursionLimit, Nullable`1 interOpNumThreads, Nullable`1 intraOpNumThreads)
at Microsoft.ML.Transforms.Onnx.OnnxTransformer..ctor(IHostEnvironment env, Options options, Byte[] modelBytes)
---> Microsoft.ML.OnnxRuntime.OnnxRuntimeException: [ErrorCode:InvalidProtobuf] Load model from Model/bertsquad-10.onnx failed:Protobuf parsing failed.
at Microsoft.ML.OnnxRuntime.NativeApiStatus.VerifySuccess(IntPtr nativeStatus)
at Microsoft.ML.OnnxRuntime.InferenceSession.Init(String modelPath, SessionOptions options, PrePackedWeightsContainer prepackedWeightsContainer)
at Microsoft.ML.OnnxRuntime.InferenceSession..ctor(String modelPath, SessionOptions options)
at Microsoft.ML.Transforms.Onnx.OnnxModel..ctor(String modelFile, Nullable`1 gpuDeviceId, Boolean fallbackToCpu, Boolean ownModelFile, IDictionary`2 shapeDictionary, Int32 recursionLimit, Nullable`1 interOpNumThreads, Nullable`1 intraOpNumThreads)
at Microsoft.ML.Transforms.Onnx.OnnxTransformer..ctor(IHostEnvironment env, Options options, Byte[] modelBytes)
--- End of inner exception stack trace ---
at Microsoft.ML.Transforms.Onnx.OnnxTransformer..ctor(IHostEnvironment env, Options options, Byte[] modelBytes)
at Microsoft.ML.Transforms.Onnx.OnnxTransformer..ctor(IHostEnvironment env, String[] outputColumnNames, String[] inputColumnNames, String modelFile, Nullable`1 gpuDeviceId, Boolean fallbackToCpu, IDictionary`2 shapeDictionary, Int32 recursionLimit, Nullable`1 interOpNumThreads, Nullable`1 intraOpNumThreads)
at Microsoft.ML.Transforms.Onnx.OnnxScoringEstimator..ctor(IHostEnvironment env, String[] outputColumnNames, String[] inputColumnNames, String modelFile, Nullable`1 gpuDeviceId, Boolean fallbackToCpu, IDictionary`2 shapeDictionary, Int32 recursionLimit, Nullable`1 interOpNumThreads, Nullable`1 intraOpNumThreads)
at Microsoft.ML.OnnxCatalog.ApplyOnnxModel(TransformsCatalog catalog, String[] outputColumnNames, String[] inputColumnNames, String modelFile, Nullable`1 gpuDeviceId, Boolean fallbackToCpu)
at Microsoft.ML.Models.BERT.Onnx.OnnxModelConfigurator`1.SetupMlNetModel(IOnnxModel onnxModel) in /home/michieal/Desktop/Projects/projects/RiderProjects/BERT-ML.NET-master/Microsoft.ML.Models.BERT/Onnx/OnnxModelConfigurator.cs:line 25
at Microsoft.ML.Models.BERT.Onnx.OnnxModelConfigurator`1..ctor(IOnnxModel onnxModel) in /home/michieal/Desktop/Projects/projects/RiderProjects/BERT-ML.NET-master/Microsoft.ML.Models.BERT/Onnx/OnnxModelConfigurator.cs:line 15
at Microsoft.ML.Models.BERT.BertModel.Initialize() in /home/michieal/Desktop/Projects/projects/RiderProjects/BERT-ML.NET-master/Microsoft.ML.Models.BERT/BertModel.cs:line 30
at BERT.Console.Program.Main(String[] args) in /home/michieal/Desktop/Projects/projects/RiderProjects/BERT-ML.NET-master/BERT.Console/Program.cs:line 18
Process finished with exit code 134.
I'm pretty curious as to how to fix this, as it should either work for both projects in the solution, or fail for both. Mind you, I had to download a new copy of the bert-squad 10 onnx model, as the one that the shell file grabbed was corrupt and only 137k, instead of ~400mb.
My use case: Learning about BERT models, and having it do Q&A's as a front end for a generative text AI Model.
Any and all help with this is very much appreciated and TIA!!!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.