Giter Club home page Giter Club logo

microsoft / mlflow.net Goto Github PK

View Code? Open in Web Editor NEW
25.0 10.0 12.0 65 KB

MLFlow.NET is a .NET Standard 2.0 based wrapper for the REST based MLFlow server API (https://mlflow.org/). The SDK package allows you to call the MLFlow server API from .NET apps. A sample use case is writing a .NET Core app that validates a machine learning model or API and stores the result in MLFlow

License: MIT License

Dockerfile 0.64% Python 1.40% C# 71.03% HTML 24.84% CSS 1.66% JavaScript 0.43%

mlflow.net's Introduction

MLFlow.NET

Build Status

Nuget (with prereleases)

MLFlow.NET is a .NET Standard 2.0 based wrapper for the REST based MLFlow server API . The SDK package allows you to call the MLFlow server API from .NET apps. A sample use case is writing a .NET Core app that validates a machine learning model or API and stores the result in MLFlow.

MLFlow.NET is a work in progress - please provide feedback via the issues tab.

Prerequisite

You need .Net core 2.2, you can download it from https://dotnet.microsoft.com/download

If you don't have correct .NET SDK you will see this error

"The current .NET SDK does not support targeting .NET Core 2.2. Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 2.2."

Getting Started

Start by installing the MLFlow.NET Package.

dotnet add package MLFlow.NET

or

Install-Package MLFlow.NET

Setting up the MLFlow.NET Services

MLFlow.NET provides an extension method to integrate with your services provider - much like services.AddMVC() in ASP.NET Core projects.

using MLFlow.NET.Lib;
using MLFlow.NET.Lib.Model;

For a web application navigate to your Startup.cs class ConfigureServices method add the services:

 services.Configure<MLFlowConfiguration>(
                Configuration.GetSection(nameof(MLFlowConfiguration)
            ));

            services.AddMFlowNet();

Configuration

The configuration file needs to be set up. You can see the setup above is using MLFlowConfiguration. Edit appsettings.json and add the following section, changing values as appropriate.

"MLFlowConfiguration": {
        "MLFlowServerBaseUrl": "http://localhost:5000",
        "APIBase": "api/2.0/preview/mlflow/"
    }

Setting up the docker container

This SDK is just a wrapper, it does not acually implement MLFLow! You'll need a server to actually store the results. We've provided one in a docker container that is super easy to use.

Navigate to /docker in the repo. You can build the Dockerfile if you like, or just use the pre-made container from Docker Hub.

To use the premade container, type docker-compose up in the /docker folder.

This will launch the ML Flow server and expose it on port 5000.

You can navigate to this address in your browser to see the results. Careful not to rely on this docker-compose orchestrated container - it will not be durable and could remove your data between runs. See the ML FLow doco for information on how to save data to another location.

Samples

There are sampes located in the /samples folder. They include an ASP.NET Core web app and an .NET Core based console application

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

mlflow.net's People

Contributors

azadehkhojandi avatar jakkaj avatar microsoft-github-policy-service[bot] avatar microsoftopensource avatar msftgits avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mlflow.net's Issues

How to make it work with Azure Databricks - MLFlow

In Azure Databricks, MLFlow is supported and can be accessed via API. The MS docs says:

You can invoke the MLflow REST API using URLs of the form https://<databricks-instance>/api/2.0/mlflow/<api-endpoint>, replacing <databricks-instance> with the <region>.azuredatabricks.net domain name of your Azure Databricks deployment.

So in my appsettings.json I have:

{
  "MLFlowConfiguration": {
    "MLFlowServerBaseUrl": "https://southeastasia.azuredatabricks.net",
    "APIBase": "api/2.0/mlflow/"
  }
}

But trying that with the lines of code below returns an exception:

var experimentName = Guid.NewGuid().ToString();
var experimentRequest = await _mlFlowService.GetOrCreateExperiment(experimentName);

Error:
'Object reference not set to an instance of an object.'

   at MLFlow.NET.Lib.Services.MLFlowService.<GetOrCreateExperiment>d__4.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at MLNETMLFlowSampleConsole.Program.<RunExperiment>d__3.MoveNext() in C:\Samples\2019\MLNETMLFlowSample\MLNETMLFlowSampleConsole\Program.cs:line 55
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at MLNETMLFlowSampleConsole.Program.<Main>d__2.MoveNext() in C:\Samples\2019\MLNETMLFlowSample\MLNETMLFlowSampleConsole\Program.cs:line 34

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.