Exemple #1
0
    def create_training_job(self,
                            TrainingJobName,
                            AlgorithmSpecification,
                            OutputDataConfig,
                            ResourceConfig,
                            InputDataConfig=None,
                            **kwargs):
        """
        Create a training job in Local Mode
        Args:
            TrainingJobName (str): local training job name.
            AlgorithmSpecification (dict): Identifies the training algorithm to use.
            InputDataConfig (dict): Describes the training dataset and the location where it is stored.
            OutputDataConfig (dict): Identifies the location where you want to save the results of model training.
            ResourceConfig (dict): Identifies the resources to use for local model traininig.
            HyperParameters (dict) [optional]: Specifies these algorithm-specific parameters to influence the quality of
                the final model.
        """
        InputDataConfig = InputDataConfig or {}
        container = _SageMakerContainer(
            ResourceConfig["InstanceType"],
            ResourceConfig["InstanceCount"],
            AlgorithmSpecification["TrainingImage"],
            self.sagemaker_session,
        )
        training_job = _LocalTrainingJob(container)
        hyperparameters = kwargs[
            "HyperParameters"] if "HyperParameters" in kwargs else {}
        training_job.start(InputDataConfig, OutputDataConfig, hyperparameters,
                           TrainingJobName)

        LocalSagemakerClient._training_jobs[TrainingJobName] = training_job
Exemple #2
0
    def create_training_job(self,
                            TrainingJobName,
                            AlgorithmSpecification,
                            OutputDataConfig,
                            ResourceConfig,
                            InputDataConfig=None,
                            Environment=None,
                            **kwargs):
        """Create a training job in Local Mode.

        Args:
          TrainingJobName(str): local training job name.
          AlgorithmSpecification(dict): Identifies the training algorithm to use.
          InputDataConfig(dict, optional): Describes the training dataset and the location where
            it is stored. (Default value = None)
          OutputDataConfig(dict): Identifies the location where you want to save the results of
            model training.
          ResourceConfig(dict): Identifies the resources to use for local model training.
          Environment(dict, optional): Describes the environment variables to pass
            to the container. (Default value = None)
          HyperParameters(dict) [optional]: Specifies these algorithm-specific parameters to
            influence the quality of the final model.
          **kwargs:

        Returns:

        """
        InputDataConfig = InputDataConfig or {}
        Environment = Environment or {}
        container = _SageMakerContainer(
            ResourceConfig["InstanceType"],
            ResourceConfig["InstanceCount"],
            AlgorithmSpecification["TrainingImage"],
            sagemaker_session=self.sagemaker_session,
        )
        training_job = _LocalTrainingJob(container)
        hyperparameters = kwargs[
            "HyperParameters"] if "HyperParameters" in kwargs else {}
        logger.info("Starting training job")
        training_job.start(InputDataConfig, OutputDataConfig, hyperparameters,
                           Environment, TrainingJobName)

        LocalSagemakerClient._training_jobs[TrainingJobName] = training_job