:py:mod:`viam.app.ml_training_client` ===================================== .. py:module:: viam.app.ml_training_client Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: viam.app.ml_training_client.MLTrainingClient Attributes ~~~~~~~~~~ .. autoapisummary:: viam.app.ml_training_client.LOGGER .. py:data:: LOGGER .. py:class:: MLTrainingClient(channel: grpclib.client.Channel, metadata: Mapping[str, str]) gRPC client for working with ML training jobs. Constructor is used by `ViamClient` to instantiate relevant service stubs. Calls to `MLTrainingClient` methods should be made through `ViamClient`. Establish a Connection:: import asyncio from viam.rpc.dial import DialOptions, Credentials from viam.app.viam_client import ViamClient async def connect() -> ViamClient: # Replace "" (including brackets) with your API key and "" with your API key ID dial_options = DialOptions.with_api_key("", "") return await ViamClient.create_from_dial_options(dial_options) async def main(): # Make a ViamClient viam_client = await connect() # Instantiate an MLTrainingClient to run ML training client API methods on ml_training_client = viam_client.ml_training_client viam_client.close() if __name__ == '__main__': asyncio.run(main()) .. py:method:: submit_training_job(org_id: str, dataset_id: str, model_name: str, model_version: str, model_type: viam.proto.app.mltraining.ModelType.ValueType, tags: List[str]) -> str :async: Submit a training job. :param org_id: the id of the org to submit the training job to :type org_id: str :param dataset_id: the id of the dataset :type dataset_id: str :param model_name: the model name :type model_name: str :param model_version: the model version :type model_version: str :param model_type: the model type :type model_type: ModelType.ValueType :param tags: the tags :type tags: List[str] :returns: the id of the training job :rtype: str .. py:method:: submit_custom_training_job(org_id: str, dataset_id: str, registry_item_id: str, model_name: str, model_version: str) -> str :async: Submit a custom training job. :param org_id: the id of the org to submit the training job to :type org_id: str :param dataset_id: the id of the dataset :type dataset_id: str :param registry_item_id: the id of the registry item :type registry_item_id: List[str] :param model_name: the model name :type model_name: str :param model_version: the model version :type model_version: str :returns: the id of the training job :rtype: str .. py:method:: get_training_job(id: str) -> viam.proto.app.mltraining.TrainingJobMetadata :async: Gets training job data. :: job_metadata = await ml_training_client.get_training_job( id="INSERT YOUR JOB ID") :param id: the id of the requested training job. :type id: str :returns: training job data. :rtype: viam.proto.app.mltraining.TrainingJobMetadata .. py:method:: list_training_jobs(org_id: str, training_status: Optional[viam.proto.app.mltraining.TrainingStatus.ValueType] = None) -> List[viam.proto.app.mltraining.TrainingJobMetadata] :async: Returns training job data for all jobs within an org. :: jobs_metadata = await ml_training_client.list_training_jobs( org_id="INSERT YOUR ORG ID") first_job_id = jobs_metadata[1].id :param org_id: the id of the org to request training job data from. :type org_id: str :param training_status: status of training jobs to filter the list by. If unspecified, all training jobs will be returned. :type training_status: Optional[TrainingStatus] :returns: a list of training job data. :rtype: List[viam.proto.app.mltraining.TrainingJobMetadata] .. py:method:: cancel_training_job(id: str) -> None :async: Cancels the specified training job. :: await ml_training_client.cancel_training_job( id="INSERT YOUR JOB ID") :param id: the id of the job to be canceled. :type id: str :raises GRPCError: if no training job exists with the given id. .. py:method:: delete_completed_training_job(id: str) -> None :async: Delete a completed training job from the database, whether the job succeeded or failed :param id: the id of the training job :type id: str