diff --git a/mlem/api/commands.py b/mlem/api/commands.py index e26edaec..991b6bf0 100644 --- a/mlem/api/commands.py +++ b/mlem/api/commands.py @@ -54,7 +54,8 @@ def apply( *data: Union[str, DatasetMeta, Any], method: str = None, output: str = None, - link: bool = False, + link: bool = None, + external: bool = None, ) -> Optional[Any]: """Apply provided model against provided data @@ -67,6 +68,7 @@ def apply( output (str, optional): If value is provided, assume it's path and save output there. link (bool): Whether to create a link to saved output in MLEM root folder. + external (bool): Whether to save result outside mlem dir Returns: If `output=None`, returns results for given data. @@ -89,7 +91,7 @@ def apply( return res[0] return res if len(res) == 1: - return save(res[0], output, link=link) + return save(res[0], output, external=external, link=link) raise NotImplementedError( "Saving several input data objects is not implemented yet" diff --git a/mlem/cli/apply.py b/mlem/cli/apply.py index 495d957a..90019f76 100644 --- a/mlem/cli/apply.py +++ b/mlem/cli/apply.py @@ -6,6 +6,7 @@ from mlem.api import import_object from mlem.cli.main import ( mlem_command, + option_external, option_json, option_link, option_repo, @@ -58,6 +59,7 @@ def apply( help="Specify how to read data file for import", # f"Available types: {list_implementations(ImportHook)}" ), link: bool = option_link, + external: bool = option_external, json: bool = option_json, ): """Apply a model to a dataset. Resulting dataset will be saved as MLEM object to `output` if it is provided, otherwise will be printed @@ -97,6 +99,7 @@ def apply( method=method, output=output, link=link, + external=external, ) if output is None and json: print( diff --git a/mlem/core/requirements.py b/mlem/core/requirements.py index 5f6f3d43..b2fc505c 100644 --- a/mlem/core/requirements.py +++ b/mlem/core/requirements.py @@ -49,6 +49,7 @@ class Requirement(MlemObject): class Config: type_root = True + default_type = "installable" abs_name: ClassVar[str] = "requirement" type: ClassVar = ...