R/model-python.R

Defines functions create_pyfunc_conf create_conda_env

create_conda_env <- function(name,
                             path,
                             channels = list("defaults"),
                             conda_deps = list(),
                             pip_deps = list()) {
  conda_deps$pip <- pip_deps
  deps <- list(
    name = name,
    channels = channels,
    dependencies = list(conda_deps)
  )
  write_yaml(deps, path)
}

create_pyfunc_conf <- function(loader_module, code = NULL, data = NULL, env = NULL) {
  res <- list(loader_module = loader_module)
  if (!is.null(code)) {
    res$code <- code
  }
  if (!is.null(data)) {
    res$data <- data
  }
  if (!is.null(env)) {
    res$env <- env
  }
  list(python_function = res)
}

Try the mlflow package in your browser

Any scripts or data that you put into this service are public.

mlflow documentation built on Sept. 6, 2021, 9:06 a.m.