DeployApi¶
- class DeployApi[source]¶
Bases:
objectMethods
Deploy a custom model based on the artifacts directory.
Deploy a custom model based on the checkpoint path.
Deploy a custom model based on the training session.
Deploy a pretrained model.
find_serving_app_by_frameworkfind_serving_app_by_slug- rtype
Get deploy info of a serving task.
get_serving_app_by_train_appLoad a custom model in running serving App.
Load a custom model in running serving App based on the training session.
Load a pretrained model in running serving App.
Run a serving app.
wait-
deploy_custom_model_by_artifacts_dir(artifacts_dir, checkpoint_name=
None, device=None, runtime=None, timeout=100, team_id=None, workspace_id=None, agent_id=None, **kwargs)[source]¶ Deploy a custom model based on the artifacts directory.
- Parameters
- artifacts_dir : str
Path to the artifacts directory in the team fies.
- checkpoint_name : Optional[str]
Checkpoint name (with file extension) to deploy, e.g. “best.pt”. If not provided, checkpoint will be chosen automatically, depending on the app version.
- device : Optional[str]
Device string. If not provided, will be chosen automatically.
- runtime : Optional[str]
Runtime string, if not present will be defined automatically.
- timeout : Optional[int]
Timeout in seconds (default is 100). The maximum time to wait for the serving app to be ready.
- team_id : Optional[int]
Team ID where the artifacts are stored. If not provided, will be taken from the current context.
- workspace_id : Optional[int]
Workspace ID where the app will be deployed. If not provided, will be taken from the current context.
- agent_id : Optional[int]
Agent ID. If not provided, will be found automatically.
- kwargs : Dict[str, Any]
Additional parameters to start the task. See Api.task.start() for more details.
- Returns
Task Info
- Return type
Dict[str, Any]
- Raises
ValueError – if validations fail.
-
deploy_custom_model_by_checkpoint(checkpoint, device=
None, runtime=None, timeout=100, team_id=None, workspace_id=None, agent_id=None, **kwargs)[source]¶ Deploy a custom model based on the checkpoint path.
- Parameters
- checkpoint : str
Path to the checkpoint in Team Files.
- device : Optional[str]
Device string. If not provided, will be chosen automatically.
- runtime : Optional[str]
Runtime string, if not present will be defined automatically.
- timeout : Optional[int]
Timeout in seconds (default is 100). The maximum time to wait for the serving app to be ready.
- team_id : Optional[int]
Team ID where the artifacts are stored. If not provided, will be taken from the current context.
- workspace_id : Optional[int]
Workspace ID where the app will be deployed. If not provided, will be taken from the current context.
- agent_id : Optional[int]
Agent ID. If not provided, will be found automatically.
- kwargs : Dict[str, Any]
Additional parameters to start the task. See Api.task.start() for more details.
- Returns
Task Info
- Return type
Dict[str, Any]
- Raises
ValueError – if validations fail.
-
deploy_custom_model_from_experiment_info(agent_id, experiment_info, checkpoint_name=
None, device=None, runtime=None, timeout=100, **kwargs)[source]¶ Deploy a custom model based on the training session.
- Parameters
- experiment_info : ExperimentInfo
an
ExperimentInfoobject.- checkpoint_name : Optional[str]
Checkpoint name (with file extension) to deploy, e.g. “best.pt”. If not provided, the best checkpoint will be chosen.
- device : Optional[str]
Device string. If not provided, will be chosen automatically.
- timeout : Optional[int]
Timeout in seconds (default is 100). The maximum time to wait for the serving app to be ready.
- kwargs : Dict[str, Any]
Additional parameters to start the task. See Api.task.start() for more details.
- Returns
Task Info
- Return type
Dict[str, Any]
- Raises
ValueError – if validations fail.
-
deploy_pretrained_model(framework, model_name, device=
None, runtime=None, workspace_id=None, agent_id=None, app=None, **kwargs)[source]¶ Deploy a pretrained model.
- Parameters
- framework : Union[str, int]
Framework name or Framework ID in Supervisely.
- model_name : str
Model name to deploy.
- device : Optional[str]
Device string. If not provided, will be chosen automatically.
- runtime : Optional[str]
Runtime string, if not present will be defined automatically.
- workspace_id : Optional[int]
Workspace ID where the app will be deployed. If not provided, will be taken from the current context.
- agent_id : Optional[int]
Agent ID. If not provided, will be found automatically.
- app : Union[str, int]
App name or App module ID in Supervisely.
- kwargs : Dict[str, Any]
Additional parameters to start the task. See Api.task.start() for more details.
- Returns
Task Info
- Return type
Dict[str, Any]
- Raises
ValueError – if no serving apps found for the app name or multiple serving apps found for the app name.
-
load_custom_model(session_id, team_id, artifacts_dir, checkpoint_name=
None, device=None, runtime=None)[source]¶ Load a custom model in running serving App.
- Parameters
- session_id : int
Task ID of the serving App.
- team_id : int
Team ID in Supervisely.
- artifacts_dir : str
Path to the artifacts directory in the team fies.
- checkpoint_name : Optional[str]
Checkpoint name (with file extension) to deploy, e.g. “best.pt”. If not provided, checkpoint will be chosen automatically, depending on the app version.
- device : Optional[str]
Device string. If not provided, will be chosen automatically.
- runtime : Optional[str]
Runtime string, if not present will be defined automatically.
-
load_custom_model_from_experiment_info(session_id, experiment_info, checkpoint_name=
None, device=None, runtime=None)[source]¶ Load a custom model in running serving App based on the training session.
- Parameters
- session_id : int
Task ID of the serving App.
- experiment_info : ExperimentInfo
an
ExperimentInfoobject.- checkpoint_name : Optional[str]
Checkpoint name (with file extension) to deploy, e.g. “best.pt”. If not provided, checkpoint will be chosen automatically, depending on the app version.
- device : Optional[str]
Device string. If not provided, will be chosen automatically.
- runtime : Optional[str]
Runtime string, if not present will be defined automatically.
-
load_pretrained_model(session_id, model_name, device=
None, runtime=None)[source]¶ Load a pretrained model in running serving App.