class_docstr: Handle end-to-end training and deployment of custom Chainer code.
docstr: This ``Estimator`` executes an Chainer script in a managed execution environment.
  
  The managed Chainer environment is an Amazon-built Docker container that executes functions
  defined in the supplied ``entry_point`` Python script within a SageMaker Training Job.
  
  Training is started by calling
  :meth:`~sagemaker.amazon.estimator.Framework.fit` on this Estimator.
  After training is complete, calling
  :meth:`~sagemaker.amazon.estimator.Framework.deploy` creates a hosted
  SageMaker endpoint and returns an
  :class:`~sagemaker.amazon.chainer.model.ChainerPredictor` instance that
  can be used to perform inference against the hosted model.
  
  Technical documentation on preparing Chainer scripts for SageMaker
  training and using the Chainer Estimator is available on the project
  home-page: https://github.com/aws/sagemaker-python-sdk
  
  Args:
      entry_point (str or PipelineVariable): Path (absolute or relative) to the Python source
          file which should be executed as the entry point to training.
          If ``source_dir`` is specified, then ``entry_point``
          must point to a file located at the root of ``source_dir``.
      use_mpi (bool or PipelineVariable): If true, entry point is run as an MPI script. By
          default, the Chainer Framework runs the entry point with
          'mpirun' if more than one instance is used.
      num_processes (int or PipelineVariable): Total number of processes to run the entry
          point with. By default, the Chainer Framework runs one process
          per GPU (on GPU instances), or one process per host (on CPU
          instances).
      process_slots_per_host (int or PipelineVariable): The number of processes that can run
          on each instance. By default, this is set to the number of GPUs
          on the instance (on GPU instances), or one (on CPU instances).
      additional_mpi_options (str or PipelineVariable): String of options to the 'mpirun'
          command used to run the entry point. For example, '-X
          NCCL_DEBUG=WARN' will pass that option string to the mpirun
          command.
      source_dir (str or PipelineVariable): Path (absolute or relative) to a directory with
          any other training source code dependencies aside from the entry
          point file (default: None). Structure within this directory are
          preserved when training on Amazon SageMaker.
      hyperparameters (dict[str, str] or dict[str, PipelineVariable]): Hyperparameters
          that will be used for training (default: None). The hyperparameters are made
          accessible as a dict[str, str] to the training code on
          SageMaker. For convenience, this accepts other types for keys
          and values, but ``str()`` will be called to convert them before
          training.
      py_version (str): Python version you want to use for executing your
          model training code. Defaults to ``None``. Required unless ``image_uri``
          is provided.
      framework_version (str): Chainer version you want to use for
          executing your model training code. Defaults to ``None``. Required unless
          ``image_uri`` is provided. List of supported versions:
          https://sagemaker.readthedocs.io/en/stable/frameworks/chainer/using_chainer.html#using-chainer-with-the-sagemaker-python-sdk.
      image_uri (str): If specified, the estimator will use this image
          for training and hosting, instead of selecting the appropriate
          SageMaker official image based on framework_version and
          py_version. It can be an ECR url or dockerhub image and tag.
  
          Examples
              * ``123412341234.dkr.ecr.us-west-2.amazonaws.com/my-custom-image:1.0``
              * ``custom-image:latest``
  
          If ``framework_version`` or ``py_version`` are ``None``, then
          ``image_uri`` is required. If also ``None``, then a ``ValueError``
          will be raised.
      **kwargs: Additional kwargs passed to the
          :class:`~sagemaker.estimator.Framework` constructor.
  
  .. tip::
  
      You can find additional parameters for initializing this class at
      :class:`~sagemaker.estimator.Framework` and
      :class:`~sagemaker.estimator.EstimatorBase`.
docstr_tok: ["This","``","Estimator","``","executes","an","Chainer","script","in","a","managed","execution","environment",".","The","managed","Chainer","environment","is","an","Amazon-built","Docker","container","that","executes","functions","defined","in","the","supplied","``","entry_point","``","Python","script","within","a","SageMaker","Training","Job",".","Training","is","started","by","calling",":","meth",":","`","~sagemaker.amazon.estimator.Framework.fit","`","on","this","Estimator",".","After","training","is","complete",",","calling",":","meth",":","`","~sagemaker.amazon.estimator.Framework.deploy","`","creates","a","hosted","SageMaker","endpoint","and","returns","an",":","class",":","`","~sagemaker.amazon.chainer.model.ChainerPredictor","`","instance","that","can","be","used","to","perform","inference","against","the","hosted","model",".","Technical","documentation","on","preparing","Chainer","scripts","for","SageMaker","training","and","using","the","Chainer","Estimator","is","available","on","the","project","home-page",":","https",":","\/\/github.com\/aws\/sagemaker-python-sdk","Args",":","entry_point","(","str","or","PipelineVariable",")",":","Path","(","absolute","or","relative",")","to","the","Python","source","file","which","should","be","executed","as","the","entry","point","to","training",".","If","``","source_dir","``","is","specified",",","then","``","entry_point","``","must","point","to","a","file","located","at","the","root","of","``","source_dir","``",".","use_mpi","(","bool","or","PipelineVariable",")",":","If","true",",","entry","point","is","run","as","an","MPI","script",".","By","default",",","the","Chainer","Framework","runs","the","entry","point","with","'mpirun","'","if","more","than","one","instance","is","used",".","num_processes","(","int","or","PipelineVariable",")",":","Total","number","of","processes","to","run","the","entry","point","with",".","By","default",",","the","Chainer","Framework","runs","one","process","per","GPU","(","on","GPU","instances",")",",","or","one","process","per","host","(","on","CPU","instances",")",".","process_slots_per_host","(","int","or","PipelineVariable",")",":","The","number","of","processes","that","can","run","on","each","instance",".","By","default",",","this","is","set","to","the","number","of","GPUs","on","the","instance","(","on","GPU","instances",")",",","or","one","(","on","CPU","instances",")",".","additional_mpi_options","(","str","or","PipelineVariable",")",":","String","of","options","to","the","'mpirun'","command","used","to","run","the","entry","point",".","For","example",",","'-X","NCCL_DEBUG=WARN","'","will","pass","that","option","string","to","the","mpirun","command",".","source_dir","(","str","or","PipelineVariable",")",":","Path","(","absolute","or","relative",")","to","a","directory","with","any","other","training","source","code","dependencies","aside","from","the","entry","point","file","(","default",":","None",")",".","Structure","within","this","directory","are","preserved","when","training","on","Amazon","SageMaker",".","hyperparameters","(","dict","[","str",",","str","]","or","dict","[","str",",","PipelineVariable","]",")",":","Hyperparameters","that","will","be","used","for","training","(","default",":","None",")",".","The","hyperparameters","are","made","accessible","as","a","dict","[","str",",","str","]","to","the","training","code","on","SageMaker",".","For","convenience",",","this","accepts","other","types","for","keys","and","values",",","but","``","str","(",")","``","will","be","called","to","convert","them","before","training",".","py_version","(","str",")",":","Python","version","you","want","to","use","for","executing","your","model","training","code",".","Defaults","to","``","None","``",".","Required","unless","``","image_uri","``","is","provided",".","framework_version","(","str",")",":","Chainer","version","you","want","to","use","for","executing","your","model","training","code",".","Defaults","to","``","None","``",".","Required","unless","``","image_uri","``","is","provided",".","List","of","supported","versions",":","https",":","\/\/sagemaker.readthedocs.io\/en\/stable\/frameworks\/chainer\/using_chainer.html","#","using-chainer-with-the-sagemaker-python-sdk",".","image_uri","(","str",")",":","If","specified",",","the","estimator","will","use","this","image","for","training","and","hosting",",","instead","of","selecting","the","appropriate","SageMaker","official","image","based","on","framework_version","and","py_version",".","It","can","be","an","ECR","url","or","dockerhub","image","and","tag",".","Examples","*","``","123412341234.dkr.ecr.us-west-2.amazonaws.com\/my-custom-image:1.0","``","*","``","custom-image",":","latest","``","If","``","framework_version","``","or","``","py_version","``","are","``","None","``",",","then","``","image_uri","``","is","required",".","If","also","``","None","``",",","then","a","``","ValueError","``","will","be","raised",".","*","*","kwargs",":","Additional","kwargs","passed","to","the",":","class",":","`","~sagemaker.estimator.Framework","`","constructor",".","..","tip",":",":","You","can","find","additional","parameters","for","initializing","this","class","at",":","class",":","`","~sagemaker.estimator.Framework","`","and",":","class",":","`","~sagemaker.estimator.EstimatorBase","`","."]
code: def __init__(
      self,
      entry_point: Union[str, PipelineVariable],
      use_mpi: Optional[Union[bool, PipelineVariable]] = None,
      num_processes: Optional[Union[int, PipelineVariable]] = None,
      process_slots_per_host: Optional[
          Union[int, PipelineVariable]
      ] = None,
      additional_mpi_options: Optional[
          Union[str, PipelineVariable]
      ] = None,
      source_dir: Optional[Union[str, PipelineVariable]] = None,
      hyperparameters: Optional[
          Dict[str, Union[str, PipelineVariable]]
      ] = None,
      framework_version: Optional[str] = None,
      py_version: Optional[str] = None,
      image_uri: Optional[Union[str, PipelineVariable]] = None,
      **kwargs,
  ):
      """This ``Estimator`` executes an Chainer script in a managed execution environment.
  
      The managed Chainer environment is an Amazon-built Docker container that executes functions
      defined in the supplied ``entry_point`` Python script within a SageMaker Training Job.
  
      Training is started by calling
      :meth:`~sagemaker.amazon.estimator.Framework.fit` on this Estimator.
      After training is complete, calling
      :meth:`~sagemaker.amazon.estimator.Framework.deploy` creates a hosted
      SageMaker endpoint and returns an
      :class:`~sagemaker.amazon.chainer.model.ChainerPredictor` instance that
      can be used to perform inference against the hosted model.
  
      Technical documentation on preparing Chainer scripts for SageMaker
      training and using the Chainer Estimator is available on the project
      home-page: https://github.com/aws/sagemaker-python-sdk
  
      Args:
          entry_point (str or PipelineVariable): Path (absolute or relative) to the Python source
              file which should be executed as the entry point to training.
              If ``source_dir`` is specified, then ``entry_point``
              must point to a file located at the root of ``source_dir``.
          use_mpi (bool or PipelineVariable): If true, entry point is run as an MPI script. By
              default, the Chainer Framework runs the entry point with
              'mpirun' if more than one instance is used.
          num_processes (int or PipelineVariable): Total number of processes to run the entry
              point with. By default, the Chainer Framework runs one process
              per GPU (on GPU instances), or one process per host (on CPU
              instances).
          process_slots_per_host (int or PipelineVariable): The number of processes that can run
              on each instance. By default, this is set to the number of GPUs
              on the instance (on GPU instances), or one (on CPU instances).
          additional_mpi_options (str or PipelineVariable): String of options to the 'mpirun'
              command used to run the entry point. For example, '-X
              NCCL_DEBUG=WARN' will pass that option string to the mpirun
              command.
          source_dir (str or PipelineVariable): Path (absolute or relative) to a directory with
              any other training source code dependencies aside from the entry
              point file (default: None). Structure within this directory are
              preserved when training on Amazon SageMaker.
          hyperparameters (dict[str, str] or dict[str, PipelineVariable]): Hyperparameters
              that will be used for training (default: None). The hyperparameters are made
              accessible as a dict[str, str] to the training code on
              SageMaker. For convenience, this accepts other types for keys
              and values, but ``str()`` will be called to convert them before
              training.
          py_version (str): Python version you want to use for executing your
              model training code. Defaults to ``None``. Required unless ``image_uri``
              is provided.
          framework_version (str): Chainer version you want to use for
              executing your model training code. Defaults to ``None``. Required unless
              ``image_uri`` is provided. List of supported versions:
              https://sagemaker.readthedocs.io/en/stable/frameworks/chainer/using_chainer.html#using-chainer-with-the-sagemaker-python-sdk.
          image_uri (str): If specified, the estimator will use this image
              for training and hosting, instead of selecting the appropriate
              SageMaker official image based on framework_version and
              py_version. It can be an ECR url or dockerhub image and tag.
  
              Examples
                  * ``123412341234.dkr.ecr.us-west-2.amazonaws.com/my-custom-image:1.0``
                  * ``custom-image:latest``
  
              If ``framework_version`` or ``py_version`` are ``None``, then
              ``image_uri`` is required. If also ``None``, then a ``ValueError``
              will be raised.
          **kwargs: Additional kwargs passed to the
              :class:`~sagemaker.estimator.Framework` constructor.
  
      .. tip::
  
          You can find additional parameters for initializing this class at
          :class:`~sagemaker.estimator.Framework` and
          :class:`~sagemaker.estimator.EstimatorBase`.
      """
      validate_version_or_image_args(
          framework_version, py_version, image_uri
      )
      if py_version == "py2":
          logger.warning(
              python_deprecation_warning(
                  self._framework_name, defaults.LATEST_PY2_VERSION
              )
          )
      self.framework_version = framework_version
      self.py_version = py_version
  
      super(Chainer, self).__init__(
          entry_point,
          source_dir,
          hyperparameters,
          image_uri=image_uri,
          **kwargs,
      )
  
      self.use_mpi = use_mpi
      self.num_processes = num_processes
      self.process_slots_per_host = process_slots_per_host
      self.additional_mpi_options = additional_mpi_options
  
file_path: sagemaker-python-sdk/src/sagemaker/chainer/estimator.py
imports: from __future__ import absolute_import
  import logging
  from typing import Union, Optional, Dict
  from sagemaker.estimator import Framework, EstimatorBase
  from sagemaker.fw_utils import framework_name_from_image, framework_version_from_tag, python_deprecation_warning, validate_version_or_image_args
  from sagemaker.chainer import defaults
  from sagemaker.chainer.model import ChainerModel
  from sagemaker.vpc_utils import VPC_CONFIG_DEFAULT
  from sagemaker.workflow.entities import PipelineVariable
label_desc: Use image node_id 1 to create a new Chainer object from inherited base classes: Framework with example: obj = Chainer(entry_point, use_mpi, num_processes, process_slots_per_host, additional_mpi_options, source_dir, hyperparameters, framework_version, py_version, image_uri)