Edit on GitHub


Deploy a model to target environment. Can use existing deployment declaration or create a new one on-the-fly.

def deploy(
    deploy_meta_or_path: Union[MlemDeploy, str],
    model: Union[MlemModel, str] = None,
    env: Union[MlemEnv, str] = None,
    project: Optional[str] = None,
    fs: Optional[AbstractFileSystem] = None,
    external: bool = None,
    index: bool = None,
) -> MlemDeploy


This API is the underlying mechanism for the mlem deployment run command and provides a programmatic way to create deployments for a target environment.


  • deploy_meta_or_path (required) - Path to deployment meta (will be created if it does not exist)
  • model (optional) - Path to model
  • env (optional) - Path to target environment
  • project (optional) - Path to MLEM project
  • fs (optional) - filesystem to load deploy meta from. If not provided, will be inferred from deploy_meta_or_path
  • external (optional) - Save result not in mlem dir, but directly in project
  • index (optional) - Whether to index output in .mlem directory
  • deploy_kwargs (optional) - Configuration for new deployment meta if it does not exist


  • MlemObjectNotFound - Thrown if we can't find MLEM object
  • ValueError - Please provide model and env args for new deployment

🐛 Found an issue? Let us know! Or fix it:

Edit on GitHub

Have a question? Join our chat, we will help you:

Discord Chat