Code Monkey home page Code Monkey logo

mlflow-project-best-practices's Introduction

mlflow-project-best-practices

An example MLFlow project

Python application test with Github Actions

High Level Architecture

end-to-end-mlops

You can Notebook see the Databricks code here: https://github.com/FourthBrain/databricks-zero-to-mlops/blob/main/src/week2-mlflow/AutoML/XGBoost-fake-news-automl.py

Example in Azure CloudShell

Screen Shot 2022-03-12 at 6 40 00 PM

Example in Github Codespaces

Screen Shot 2022-03-12 at 7 11 31 PM

Curl Example

curl \
  -u token:$DATABRICKS_TOKEN \
  -X POST \
  -H "Content-Type: application/json; format=pandas-records" \
  [email protected] \
  https://adb-2951765055089996.16.azuredatabricks.net/model/Fake-News/1/invocations

Deploy Architecture

IMG_0217

Query registered model

Query with Databricks CLI

  1. Create a databricks config: touch ~/.databrickscfg
  2. Put in host and token
  3. Query jobs

databricks jobs list --output JSON | jq 4. List clusters

databricks clusters list --output JSON | jq

  1. List contents of DBFS

databricks fs ls dbfs:/

Query for Models with API

You need to set the tracking URI.

export MLFLOW_TRACKING_URI=databricks
from pprint import pprint
from mlflow.tracking import MlflowClient
client = MlflowClient()
for rm in client.list_registered_models():
  pprint(dict(rm), indent=4)

Download Model

CLI version

mlflow artifacts download --artifact-uri models:/<name>/<version|stage>

To use Python do the following:

from mlflow.store.artifact.models_artifact_repo import ModelsArtifactRepository

model_uri = MlflowClient.get_model_version_download_uri(model_name, model_version)
ModelsArtifactRepository(model_uri).download_artifacts(artifact_path="")

Register model for AWS Sagemaker

Screen Shot 2022-03-16 at 1 53 31 PM

Goal for today

  • Databricks Tensorflow run
  • Feature Store
  • Model Serving

Model Serving

https://docs.databricks.com/applications/mlflow/model-serving.html

Run it with mlserve

 mlflow models serve --model-uri  /workspaces/mlflow-project-best-practices/tf-model

mlflow-project-best-practices's People

Contributors

noahgift avatar

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.