{"id":20282352,"url":"https://github.com/redisai/mlflow-redisai","last_synced_at":"2025-04-11T08:00:11.576Z","repository":{"id":43651930,"uuid":"226862524","full_name":"RedisAI/mlflow-redisai","owner":"RedisAI","description":"RedisAI integration for MLFlow","archived":false,"fork":false,"pushed_at":"2023-05-01T13:44:51.000Z","size":37,"stargazers_count":30,"open_issues_count":9,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-25T05:36:33.399Z","etag":null,"topics":["deep-learning","machine-l","mlflow","onnx","pytorch","redisai","tensorflow"],"latest_commit_sha":null,"homepage":"https://redisai.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RedisAI.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-09T12:09:50.000Z","updated_at":"2024-07-12T18:17:27.000Z","dependencies_parsed_at":"2022-09-02T08:32:07.329Z","dependency_job_id":null,"html_url":"https://github.com/RedisAI/mlflow-redisai","commit_stats":null,"previous_names":["hhsecond/mlflow-redisai"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedisAI%2Fmlflow-redisai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedisAI%2Fmlflow-redisai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedisAI%2Fmlflow-redisai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedisAI%2Fmlflow-redisai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RedisAI","download_url":"https://codeload.github.com/RedisAI/mlflow-redisai/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248360154,"owners_count":21090657,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","machine-l","mlflow","onnx","pytorch","redisai","tensorflow"],"created_at":"2024-11-14T14:09:03.923Z","updated_at":"2025-04-11T08:00:11.525Z","avatar_url":"https://github.com/RedisAI.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mlflow-redisai\n[![Forum](https://img.shields.io/badge/Forum-RedisAI-blue)](https://forum.redislabs.com/c/modules/redisai)\n[![Discord](https://img.shields.io/discord/697882427875393627?style=flat-square)](https://discord.gg/rTQm7UZ)\n\nA plugin that integrates RedisAI with MLflow pipeline. ``mlflow_redisai`` enables you to\nuse mlflow to deploy the models built and trained in mlflow pipeline into RedisAI without any\nextra effort from the user. This plugin provides few command line APIs, which is also accessible\nthrough mlflow's python package, to make the deployment process seamless.\n\n## Installation\nFor installing and activating the plugin, you only need to install this package which is available\nin pypi and can be installed with\n\n```bash\npip install mlflow_redisai\n```\n\n## What does it do\nInstalling this package uses python's amazing entrypoint mechanism to register the plugin into MLflow's\nplugin registry. This registry will be invoked each time you launch MLflow script or command line\nargument.\n\n## Options\nThis plugin allows you to interact with RedisAI deployment through MLflow using below given options.\nAll of these options are accessible through command line and python API, although the predict command\nline option is not reliable in the current release. if you are connecting to a non-local RedisAI instance\nor if your RedisAI instance needs non-default connection parameters such as username or password, take a\nlook at the [connection parameters section](#connection-parameters)\n\n### Create deployment\nDeploy the model to RedisAI. The `create` command line argument and ``create_deployment`` python\nAPIs does the deployment of a model built with MLflow to RedisAI. It fetches the information, such as\nwhich framework the model is built on, from the model configuration file implicitly.\n\n##### CLI\n```shell script\nmlflow deployments create -t redisai --name \u003crediskey\u003e -m \u003cmodel uri\u003e -C \u003cconfig option\u003e\n```\n\n##### Python API\n```python\nfrom mlflow.deployments import get_deploy_client\ntarget_uri = 'redisai'  # host = localhost, port = 6379\nredisai = get_deploy_client(target_uri)\nredisai.create_deployment(rediskey, model_uri, config={'device': 'GPU'})\n```\n\n### Update deployment\nUpdate deployment API has a very similar signature to the create API. In face, update deployment\ndoes exactly the same operation as create API except that the model should already be deployed.\nIf the model is not present already, it raises an exception. Update API can be used to update\na new model after retraining. This type of setup is useful if you want to change the device on which\nthe inference is running or if you want to change the autobatching size, or even if you are doing live \ntraining and updating the model on the fly . RedisAI will make sure the user experience is seamless\nwhile changing the model in a live environment.\n\n##### CLI\n```shell script\nmlflow deployments update -t redisai --name \u003crediskey\u003e -m \u003cmodel uri\u003e -C \u003cconfig option\u003e\n```\n\n##### Python API\n```python\nredisai.update_deployment(rediskey, model_uri, config={'device': 'GPU'})\n```\n\n### Delete deployment\nDelete an existing deployment. Error will be thrown if the model is not already deployed\n\n##### CLI\n```shell script\nmlflow deployments delete -t redisai --name \u003crediskey\u003e\n```\n\n##### Python API\n```python\nredisai.delete_deployment(rediskey)\n```\n\n### List all deployments\nList the names of all the deployments. This name can then be used in other APIs or can be\nused in the get deployment API to get more details about a particular deployment. Currently,\nit displays every deployment, not just the deployment made through this plugin\n\n##### CLI\n```shell script\nmlflow deployments list -t redisai\n```\n\n##### Python API\n```python\nredisai.list_deployments()\n```\n\n### Get deployment details\nGet API fetches the meta data about a deployment from RedisAI. This metadata includes\n\n- BACKEND : the backend used by the model as a String\n- DEVICE : the device used to execute the model as a String\n- TAG : the model's tag as a String\n- BATCHSIZE : The maximum size of any batch of incoming requests. If BATCHSIZE is equal to 0 each incoming request is served immediately. When BATCHSIZE is greater than 0, the engine will batch incoming requests from multiple clients that use the model with input tensors of the same shape.\n- MINBATCHSIZE : The minimum size of any batch of incoming requests.\n- INPUTS : array reply with one or more names of the model's input nodes (applicable only for TensorFlow models)\n- OUTPUTS : array reply with one or more names of the model's output nodes (applicable only for TensorFlow models)\n\n##### CLI\n```shell script\nmlflow deployments get -t redisai --name \u003crediskey\u003e\n```\n\n##### Python API\n```python\nredisai.get_deployment(rediskey)\n```\n\n### Plugin help\nMLflow integration also made a handy help API which is specific to any plugins you install rather\nthan the help string of the mlflow command itself. For quickly checking something out, it'd be\neasy to use the help API rather than looking out for this document.\n\nPS: Since help is specific to the plugin and not really an attribute of the client object itself,\nit's not available under client object (`redisai` variable in the above examples)\n\n##### CLI\n```shell script\nmlflow deployments help -t redisai\n``` \n\n### Local run\nIf you are new to RedisAI and trying it out for the first time, you might not know the setup already\n(although it's quite easy to setup a local RedisAI instance). The `local-run` API is there to help\nyou, if that's the case. It pulls the latest docker image of RedisAI (yes, you need docker installed in your\nmachine for this to work), run it on the default port, deploy the model you specified.\n\nPS: It's IMPORTANT to note that this API leaves the docker container running. You would need to manually\nstop the container once you are done with experimentation. Also, remember that if you trying to run\nthis API twice without killing the first container, it throws an error saying the port is already\nin use.\n\n##### CLI\n```shell script\nmlflow deployments run-local -t redisai --name \u003crediskey\u003e -m \u003cmodel uri\u003e -C \u003cconfig option\u003e\n```\n\n\n## Connection Parameters\nFor connecting to a RedisAI instance with non-default connection parameters, you'd either need to\nsupply the necessary (and allowed) parameters through environmental variables or modify the target\nURI that you'd pass through the command line using `-t` or `-target` option.\n\n##### Through environmental variables\n\nCurrently this plugin allows five options through environmental variables which are given below\n(without description because they are self explanatory)\n\n* REDIS_HOST\n* REDIS_PORT\n* REDIS_DB\n* REDIS_USERNAME\n* REDIS_PASSWORD\n\n##### Modifying URI\nA template for quick verification is given below\n```\nredisai:/[[username]:[password]]@[host]:[port]/[db]\n```\n\nwhere the default value each would be\n- username = None\n- password = None\n- host = localhost\n- port = 6379\n- db = 0\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredisai%2Fmlflow-redisai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredisai%2Fmlflow-redisai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredisai%2Fmlflow-redisai/lists"}