dotnet / machinelearning

ML.NET is an open source and cross-platform machine learning framework for .NET.
https://dot.net/ml
MIT License
9.04k stars 1.89k forks source link

[Question] Model serialization and store in database #5740

Closed Lazar-source closed 3 years ago

Lazar-source commented 3 years ago

System information

Issue

I'm in a project and we are using mlnet. We are using a lot of models with different trainers. I know there is a way to save it as a zip file, but i didnt like that solution. My question is: Is there a way to serialize the trained model(object) and store it in database? I havent found any information related to it, and i dont know a lot about serialization.

Thanks for answers!

PeterKottas commented 3 years ago

Simply save it to stream and you can do anything you want with the stream. Generally speaking, storing stuff like this in DB is not a good idea though, at least not in relational DB. I would recommend some blob storage or FTP.

PeterKottas commented 3 years ago

Sidenote, to avoid confusion, the stream will actually be in a "form" of zip. Therefore if you decide to for instance upload the stream to FTP, feel free to just add the zip extension. One way or another, you can just as easily load the model from the stream, so technically, you don't even have to worry about what format it is.

Lazar-source commented 3 years ago

Thanks for the answer and sorry for the late reply!

PeterKottas commented 3 years ago

No worries, happy to help.