Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions dataikuapi/dss/savedmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,15 @@ def get_origin_ml_task(self):
if fmi is not None:
return DSSMLTask.from_full_model_id(self.client, fmi, project_key=self.project_key)

def import_mlflow_version_from_path(self, version_id, path):
def import_mlflow_version_from_path(self, version_id, path, code_env_name="INHERIT"):
"""
Create a new version for this saved model from a path containing a MLFlow model.

Requires the saved model to have been created using :meth:`dataikuapi.dss.project.DSSProject.create_mlflow_pyfunc_model`.

:param str version_id: Identifier of the version to create
:param str path: An absolute path on the local filesystem. Must be a folder, and must contain a MLFlow model
:param str code_env_name: Name of the code environment to use for this model. Default is to inherit from project configuration

:return a :class:MLFlowVersionHandler in order to interact with the new MLFlow model version
"""
Expand All @@ -136,7 +137,7 @@ def import_mlflow_version_from_path(self, version_id, path):

with open("tmpmodel.zip", "rb") as fp:
self.client._perform_empty("POST", "/projects/%s/savedmodels/%s/versions/%s" % (self.project_key, self.sm_id, version_id),
files={"file":("tmpmodel.zip", fp)})
files={"file":("tmpmodel.zip", fp)}, params={"codeEnvName": code_env_name})

return self.get_mlflow_version_handler(version_id)

Expand Down