Flexible Model Deployment
How to define the environment my model needs?
Fiddler Platform supports models with varying dependencies. For example, the Fiddler platform allows you to have two models running the same library but with incompatible versions through our flexible model deployment feature.
When you add a model artifact into Fiddler (see add_model_artifact), you can specify the deployment needed to run the model.
add_model_artifact now takes a
deployment_params argument where you can specify the following information using fdl.DeploymentParams:
image_uri: This is the docker image used to create a new runtime to serve the model. You can choose a base image from the following list, with the matching requirements for your model:
Each base image comes with a few pre-installed libraries and these can be overridden by specifying requirements.txt file inside your model artifact directory where package.py is defined.
md-base/python/python-38 is an image with the least pre-installed dependencies, use this if none of the other images matches your requirement.
Installing new dependencies at runtime will take time and is prone to network errors.
replicas: The number of replicas running the model.
memory: The amount of memory (mebibytes) reserved per replica. Models with many features as well as NLP models might need more memory than the default setting.
Your model might need more memory than the default setting. If you get a
ModelServeErrorerror when adding a model, it means you didn't provide enough memory for your model. It may take a few iterations of increasing CPU/Memory values until the model is loaded and no error is returned.
cpu: The amount of CPU (milli cpus) reserved per replica.
Both add_model_artifact and update_model_artifact methods support passing
deployment_params. For example:
PROJECT_ID = 'example_project' MODEL_ID = 'example_model' # Specify deployment parameters deployment_params = fdl.DeploymentParams( image_uri="md-base/python/machine-learning:1.0.0", cpu=250, memory=512, replicas=1, ) # Add model artifact client.add_model_artifact( project_id=PROJECT_ID, model_id=MODEL_ID, model_dir='model_dir/', deployment_params=deployment_params, )
Once the model is added in Fiddler, you can fine-tune the model deployment based on the scaling requirements, using update_model_deployment. This function allows you to:
- Horizontal scaling: horizontal scaling via replicas parameter. This will create multiple Kubernetes pods internally to handle requests.
- Vertical scaling: Model deployments support vertical scaling via cpu and memory parameters. Some models might need more memory to load the artifacts into memory or process the requests.
- Scale down: You may want to scale down the model deployments to avoid allocating the resources when the model is not in use. Use active parameters to scale down the deployment.
- Scale up: This will again create the model deployment Kubernetes pods with the resource values available in the database.
Supported from server version
23.1with Flexible Model Deployment feature enabled.
Updated 13 days ago