Giter VIP home page Giter VIP logo

functions's Introduction

Build Status License PyPI version fury.io Documentation Ruff GitHub commit activity GitHub release (latest SemVer) Join MLOps Live

MLRun logo

Using MLRun

MLRun is an open MLOps platform for quickly building and managing continuous ML applications across their lifecycle. MLRun integrates into your development and CI/CD environment and automates the delivery of production data, ML pipelines, and online applications, significantly reducing engineering efforts, time to production, and computation resources. With MLRun, you can choose any IDE on your local machine or on the cloud. MLRun breaks the silos between data, ML, software, and DevOps/MLOps teams, enabling collaboration and fast continuous improvements.

Get started with MLRun Tutorials and Examples, Installation and setup guide, or read about MLRun Architecture.

This page explains how MLRun addresses the MLOps Tasks and the MLRun core components.

MLOps tasks

mlrun-tasks


The MLOps development workflow section describes the different tasks and stages in detail. MLRun can be used to automate and orchestrate all the different tasks or just specific tasks (and integrate them with what you have already deployed).

Project management and CI/CD automation

In MLRun the assets, metadata, and services (data, functions, jobs, artifacts, models, secrets, etc.) are organized into projects. Projects can be imported/exported as a whole, mapped to git repositories or IDE projects (in PyCharm, VSCode, etc.), which enables versioning, collaboration, and CI/CD. Project access can be restricted to a set of users and roles.

See: Docs: Projects and Automation, CI/CD Integration, Tutorials: Quick start, Automated ML Pipeline, Video: Quick start.

Ingest and process data

MLRun provides abstract interfaces to various offline and online data sources, supports batch or realtime data processing at scale, data lineage and versioning, structured and unstructured data, and more. In addition, the MLRun Feature Store automates the collection, transformation, storage, catalog, serving, and monitoring of data features across the ML lifecycle and enables feature reuse and sharing.

See: Docs: Ingest and process data, Feature Store, Data & Artifacts; Tutorials: Quick start, Feature Store.

Develop and train models

MLRun allows you to easily build ML pipelines that take data from various sources or the Feature Store and process it, train models at scale with multiple parameters, test models, tracks each experiments, register, version and deploy models, etc. MLRun provides scalable built-in or custom model training services, integrate with any framework and can work with 3rd party training/auto-ML services. You can also bring your own pre-trained model and use it in the pipeline.

See: Docs: Develop and train models, Model Training and Tracking, Batch Runs and Workflows; Tutorials: Train, compare, and register models, Automated ML Pipeline; Video: Train and compare models.

Deploy models and applications

MLRun rapidly deploys and manages production-grade real-time or batch application pipelines using elastic and resilient serverless functions. MLRun addresses the entire ML application: intercepting application/user requests, running data processing tasks, inferencing using one or more models, driving actions, and integrating with the application logic.

See: Docs: Deploy models and applications, Realtime Pipelines, Batch Inference, Tutorials: Realtime Serving, Batch Inference, Advanced Pipeline; Video: Serving pre-trained models.

Monitor and alert

Observability is built into the different MLRun objects (data, functions, jobs, models, pipelines, etc.), eliminating the need for complex integrations and code instrumentation. With MLRun, you can observe the application/model resource usage and model behavior (drift, performance, etc.), define custom app metrics, and trigger alerts or retraining jobs.

See: Docs: Monitor and alert, Model Monitoring Overview, Tutorials: Model Monitoring & Drift Detection.

MLRun core components

mlrun-core


MLRun includes the following major components:

Project Management: A service (API, SDK, DB, UI) that manages the different project assets (data, functions, jobs, workflows, secrets, etc.) and provides central control and metadata layer.

Functions: automatically deployed software package with one or more methods and runtime-specific attributes (such as image, libraries, command, arguments, resources, etc.).

Data & Artifacts: Glueless connectivity to various data sources, metadata management, catalog, and versioning for structures/unstructured artifacts.

Feature Store: automatically collects, prepares, catalogs, and serves production data features for development (offline) and real-time (online) deployment using minimal engineering effort.

Batch Runs & Workflows: Execute one or more functions with specific parameters and collect, track, and compare all their results and artifacts.

Real-Time Serving Pipeline: Rapid deployment of scalable data and ML pipelines using real-time serverless technology, including API handling, data preparation/enrichment, model serving, ensembles, driving and measuring actions, etc.

Real-Time monitoring: monitors data, models, resources, and production components and provides a feedback loop for exploring production data, identifying drift, alerting on anomalies or data quality issues, triggering retraining jobs, measuring business impact, etc.

functions's People

Contributors

alxzed avatar assaf758 avatar aviaiguazio avatar daniels290813 avatar davesh0812 avatar eliyahu77 avatar eyal-danieli avatar gilad-shaham avatar giladshapira94 avatar guy1992l avatar hedingber avatar idan707 avatar jond01 avatar katyakats avatar marcelonyc avatar michaelliv avatar nirse avatar nschenone avatar pengwei715 avatar rokatyy avatar royeis avatar thesaarco avatar tomerm-iguazio avatar uriblum46 avatar xsqian avatar yaronha avatar yonishelach avatar yuribros1974 avatar zeevrispler avatar zilbermanor 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

functions's Issues

describe cpu function slow

describe is slow for the most part due to seaborn pairplot. The seaborn sourcecode has a comment suggesting plot set-up is the time-consuming part.

Needed is a new parameter that limits the number of items plotted:

  • only those where the distributions are significantly different, plus
  • an upper limit

tf2_serving_v2 Notebook update

I was going through the tf2_serving_v2 notebook and i noticed that methods that were mentioned in text cell above were actually from tf2_serving notebook. It led to some confusion in the start and once i had gone through both of these notebooks i could tell the difference, maybe you can look into this and update it. I will add some snippets from tf2_serving_v2 notebook for your reference.

iguazio_issue
iguazio_issue2

Create "Live" Test-Model function (vs. Running endpoint)

We would like to be able and test a running model endpoint.

The function should receive:

  • Test dataset
  • Endpoint

Tests:

  • Is the endpoint working ? (i.e. receiving 200)

    • If we get errors - what are they? (stacktrace)
  • Quality: Model evaluation metrics....

  • Performance: Latency, request time, etc...

All inputs should support MLRun DataItem

We need to verify that all our functions support receiving tables and configurations as MLRun's DataItem (input).

Some functions still support receiving tables / files via filepath string only.

This is specially important since we are adding more capabilities to MLRun's Artifact store and specially the Project / DB Level artifacts which will be saved under store://.

Fix describe function

When running the describe function with mlrun/mlrun-models:0.4.5 the following error occurs:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.7/site-packages/mlrun/runtimes/local.py", line 179, in exec_from_params
    val = handler(*args_list)
  File "main.py", line 53, in describe
    snsplt = sns.pairplot(table, hue=label_column)
  File "/opt/conda/lib/python3.7/site-packages/seaborn/axisgrid.py", line 2121, in pairplot
    grid.map_diag(kdeplot, **diag_kws)
  File "/opt/conda/lib/python3.7/site-packages/seaborn/axisgrid.py", line 1490, in map_diag
    func(data_k, label=label_k, color=color, **kwargs)
  File "/opt/conda/lib/python3.7/site-packages/seaborn/distributions.py", line 705, in kdeplot
    cumulative=cumulative, **kwargs)
  File "/opt/conda/lib/python3.7/site-packages/seaborn/distributions.py", line 295, in _univariate_kdeplot
    cumulative=cumulative)
  File "/opt/conda/lib/python3.7/site-packages/seaborn/distributions.py", line 367, in _statsmodels_univariate_kde
    kde.fit(kernel, bw, fft, gridsize=gridsize, cut=cut, clip=clip)
  File "/opt/conda/lib/python3.7/site-packages/statsmodels/nonparametric/kde.py", line 140, in fit
    clip=clip, cut=cut)
  File "/opt/conda/lib/python3.7/site-packages/statsmodels/nonparametric/kde.py", line 453, in kdensityfft
    bw = bandwidths.select_bandwidth(X, bw, kern) # will cross-val fit this pattern?
  File "/opt/conda/lib/python3.7/site-packages/statsmodels/nonparametric/bandwidths.py", line 174, in select_bandwidth
    raise RuntimeError(err)
RuntimeError: Selected KDE bandwidth is 0. Cannot estimate density.

Function yaml:

kind: job
metadata:
  name: describe
  tag: ''
  hash: 5eb3219b3dd8c944bf6427ad37de31511c07d944
  project: network-operations
  labels:
    author: yjb
    stage: development
  categories:
  - models
  - graphics
spec:
  command: ''
  args: []
  image: mlrun/ml-models:0.4.5
  volumes:
  - flexVolume:
      driver: v3io/fuse
      options:
        accessKey: <...>
        container: users
        subPath: /admin
    name: v3io
  volume_mounts:
  - mountPath: /User
    name: v3io
  env:
  - name: V3IO_API
    value: v3io-webapi.default-tenant.svc:8081
  - name: V3IO_USERNAME
    value:  <...>
  - name: V3IO_ACCESS_KEY
    value: <...>
  default_handler: describe
  description: ''
  build:
    functionSourceCode: IyBHZW5lcmF0ZWQgYnkgbnVjbGlvLmV4cG9ydC5OdWNsaW9FeHBvcnRlciBvbiAyMDIwLTAzLTE3IDE1OjQzCgppbXBvcnQgb3MKaW1wb3J0IG51bXB5IGFzIG5wCmltcG9ydCBwYW5kYXMgYXMgcGQKaW1wb3J0IG1hdHBsb3RsaWIucHlwb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9L2ltYmFsYW5jZS5odG1sIikKICAgIAogICAgX2djZl9jbGVhcihwbHQpCiAgICB0Ymxjb3JyID0gdGFibGUuY29ycigpCiAgICBheCA9IHBsdC5heGVzKCkKICAgIHNucy5oZWF0bWFwKHRibGNvcnIsIGF4PWF4LCBhbm5vdD1GYWxzZSwgY21hcD1wbHQuY20uUmVkcykKICAgIGF4LnNldF90aXRsZSgiZmVhdHVyZXMgY29ycmVsYXRpb24iKQogICAgcGx0LnNhdmVmaWcob3MucGF0aC5qb2luKGJhc2VfcGF0aCwgZiJ7cGxvdHNfZGVzdH0vY29yci5wbmciKSkKICAgIGNvbnRleHQubG9nX2FydGlmYWN0KFBsb3RBcnRpZmFjdCgiY29ycmVsYXRpb24iLCAgYm9keT1wbHQuZ2NmKCkpLCBsb2NhbF9wYXRoPWYie3Bsb3RzX2Rlc3R9Y29yci5odG1sIikKICAgIAogICAKICAgIF9nY2ZfY2xlYXIocGx0KQoK
    commands: []
    code_origin: https://github.com/mlrun/functions.git#b0ba922e10fa0af2fcf2e04cce51eb7d9243bf25:describe/describe.ipynb

And the following task:

summ_task = NewTask(
    "sum", 
    handler="describe",  
    params={"key": "summary", 
            "label_column": "is_error", 
            'class_labels': ['0', '1'],
            'plot_hist': True,
            'plot_dest': 'plots'},
    inputs={"table": os.path.join(project_dir, 'data', 'aggregate.pq')},
    artifact_path=ARTIFACT_PATH)

open_archive only top folder for zipfile

  1. tar.gz and zip files quite often contain nested archives. tarfile recursively extracts files, zipfile doesn't and requires an extra step. This leaves the artifact contents incompletely extracted.
  2. In either case folder and final file locations aren't clear by default.
  3. We may want to log all the nested file contents as artifacts, particularly if they are tables, if they are layered images (image_blue, image_red, image_green) we may want to generate a metadata description summarizing these findings...
    (idea: if 3. is the case, and the files represent keys and data, normalized database tables, the extract process might also recommend possible joins)

Batch Inference V2 tensor flow model

I am trying to find the drift detection using batch inference V2 for the tensor flow model. Facing issue while passing the data in np.ndarry . So i am saving my data in .npy artifact and mapping it to input data set (also tried passing it into param ) . It is always throwing error .

I am passing

run = project.run_function(
batch_inference_function,
inputs={"dataset": trainer_run.outputs['prediction_set']},
params={

    "model_path": trainer_run.outputs['model']
},
local=True

)

#here trainer_run.outputs['prediction_set'] is in .npy format

File "/opt/conda/lib/python3.9/site-packages/mlrun/runtimes/local.py", line 441, in exec_from_params
val = mlrun.handler(
File "/opt/conda/lib/python3.9/site-packages/mlrun/package/init.py", line 140, in wrapper
func_outputs = func(*args, **kwargs)
File "/tmp/tmpqwz0zi74.py", line 209, in infer
x, label_columns = mlrun.model_monitoring.api.read_dataset_as_dataframe(
File "/opt/conda/lib/python3.9/site-packages/mlrun/model_monitoring/api.py", line 599, in read_dataset_as_dataframe
dataset = dataset.as_df()
File "/opt/conda/lib/python3.9/site-packages/mlrun/datastore/base.py", line 510, in as_df
df = self._store.as_df(
File "/opt/conda/lib/python3.9/site-packages/mlrun/datastore/base.py", line 283, in as_df
raise Exception(f"file type unhandled {url}")
Exception: file type unhandled s3://mlrun/projects/temp-pipeline-jovyan/artifacts/trainer-train/0/prediction_set.npy

2024-03-09 01:42:04,268 [error] exec error - file type unhandled s3://mlrun/projects/temp-pipeline-jovyan/artifacts/trainer-train/0/prediction_set.npy

Please provide the demo for tensor flow libraries as well

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.