class_docstr: A Hugging Face SageMaker ``Model`` that can be deployed to a SageMaker ``Endpoint``.
class_docstr_tok: ["A","Hugging","Face","SageMaker","``","Model","``","that","can","be","deployed","to","a","SageMaker","``","Endpoint","``","."]
docstr: Initialize a HuggingFaceModel.
  
  Args:
      model_data (str or PipelineVariable): The Amazon S3 location of a SageMaker
          model data ``.tar.gz`` file.
      role (str): An AWS IAM role specified with either the name or full ARN. The Amazon
          SageMaker training jobs and APIs that create Amazon SageMaker
          endpoints use this role to access training data and model
          artifacts. After the endpoint is created, the inference code
          might use the IAM role, if it needs to access an AWS resource.
      entry_point (str): The absolute or relative path to the Python source
          file that should be executed as the entry point to model
          hosting. If ``source_dir`` is specified, then ``entry_point``
          must point to a file located at the root of ``source_dir``.
          Defaults to None.
      transformers_version (str): Transformers version you want to use for
          executing your model training code. Defaults to None. Required
          unless ``image_uri`` is provided.
      tensorflow_version (str): TensorFlow version you want to use for
          executing your inference code. Defaults to ``None``. Required unless
          ``pytorch_version`` is provided. The current supported version is ``2.4.1``.
      pytorch_version (str): PyTorch version you want to use for
          executing your inference code. Defaults to ``None``. Required unless
          ``tensorflow_version`` is provided. The current supported versions are ``1.7.1`` and ``1.6.0``.
      py_version (str): Python version you want to use for executing your
          model training code. Defaults to ``None``. Required unless
          ``image_uri`` is provided.
      image_uri (str or PipelineVariable): A Docker image URI. Defaults to None.
          If not specified, a default image for PyTorch will be used. If ``framework_version``
          or ``py_version`` are ``None``, then ``image_uri`` is required. If
          also ``None``, then a ``ValueError`` will be raised.
      predictor_cls (callable[str, sagemaker.session.Session]): A function
          to call to create a predictor with an endpoint name and
          SageMaker ``Session``. If specified, ``deploy()`` returns the
          result of invoking this function on the created endpoint name.
      model_server_workers (int or PipelineVariable): Optional. The number of
          worker processes used by the inference server. If None, server will use one
          worker per vCPU.
      **kwargs: Keyword arguments passed to the superclass
          :class:`~sagemaker.model.FrameworkModel` and, subsequently, its
          superclass :class:`~sagemaker.model.Model`.
  
  .. tip::
  
      You can find additional parameters for initializing this class at
      :class:`~sagemaker.model.FrameworkModel` and
      :class:`~sagemaker.model.Model`.
docstr_tok: ["Initialize","a","HuggingFaceModel",".","Args",":","model_data","(","str","or","PipelineVariable",")",":","The","Amazon","S3","location","of","a","SageMaker","model","data","``",".tar.gz","``","file",".","role","(","str",")",":","An","AWS","IAM","role","specified","with","either","the","name","or","full","ARN",".","The","Amazon","SageMaker","training","jobs","and","APIs","that","create","Amazon","SageMaker","endpoints","use","this","role","to","access","training","data","and","model","artifacts",".","After","the","endpoint","is","created",",","the","inference","code","might","use","the","IAM","role",",","if","it","needs","to","access","an","AWS","resource",".","entry_point","(","str",")",":","The","absolute","or","relative","path","to","the","Python","source","file","that","should","be","executed","as","the","entry","point","to","model","hosting",".","If","``","source_dir","``","is","specified",",","then","``","entry_point","``","must","point","to","a","file","located","at","the","root","of","``","source_dir","``",".","Defaults","to","None",".","transformers_version","(","str",")",":","Transformers","version","you","want","to","use","for","executing","your","model","training","code",".","Defaults","to","None",".","Required","unless","``","image_uri","``","is","provided",".","tensorflow_version","(","str",")",":","TensorFlow","version","you","want","to","use","for","executing","your","inference","code",".","Defaults","to","``","None","``",".","Required","unless","``","pytorch_version","``","is","provided",".","The","current","supported","version","is","``","2.4.1","``",".","pytorch_version","(","str",")",":","PyTorch","version","you","want","to","use","for","executing","your","inference","code",".","Defaults","to","``","None","``",".","Required","unless","``","tensorflow_version","``","is","provided",".","The","current","supported","versions","are","``","1.7.1","``","and","``","1.6.0","``",".","py_version","(","str",")",":","Python","version","you","want","to","use","for","executing","your","model","training","code",".","Defaults","to","``","None","``",".","Required","unless","``","image_uri","``","is","provided",".","image_uri","(","str","or","PipelineVariable",")",":","A","Docker","image","URI",".","Defaults","to","None",".","If","not","specified",",","a","default","image","for","PyTorch","will","be","used",".","If","``","framework_version","``","or","``","py_version","``","are","``","None","``",",","then","``","image_uri","``","is","required",".","If","also","``","None","``",",","then","a","``","ValueError","``","will","be","raised",".","predictor_cls","(","callable","[","str",",","sagemaker.session.Session","]",")",":","A","function","to","call","to","create","a","predictor","with","an","endpoint","name","and","SageMaker","``","Session","``",".","If","specified",",","``","deploy","(",")","``","returns","the","result","of","invoking","this","function","on","the","created","endpoint","name",".","model_server_workers","(","int","or","PipelineVariable",")",":","Optional",".","The","number","of","worker","processes","used","by","the","inference","server",".","If","None",",","server","will","use","one","worker","per","vCPU",".","*","*","kwargs",":","Keyword","arguments","passed","to","the","superclass",":","class",":","`","~sagemaker.model.FrameworkModel","`","and",",","subsequently",",","its","superclass",":","class",":","`","~sagemaker.model.Model","`",".","..","tip",":",":","You","can","find","additional","parameters","for","initializing","this","class","at",":","class",":","`","~sagemaker.model.FrameworkModel","`","and",":","class",":","`","~sagemaker.model.Model","`","."]
code: def __init__(
      self,
      role: Optional[str] = None,
      model_data: Optional[Union[str, PipelineVariable]] = None,
      entry_point: Optional[str] = None,
      transformers_version: Optional[str] = None,
      tensorflow_version: Optional[str] = None,
      pytorch_version: Optional[str] = None,
      py_version: Optional[str] = None,
      image_uri: Optional[Union[str, PipelineVariable]] = None,
      predictor_cls: callable = HuggingFacePredictor,
      model_server_workers: Optional[
          Union[int, PipelineVariable]
      ] = None,
      **kwargs,
  ):
      """Initialize a HuggingFaceModel.
  
      Args:
          model_data (str or PipelineVariable): The Amazon S3 location of a SageMaker
              model data ``.tar.gz`` file.
          role (str): An AWS IAM role specified with either the name or full ARN. The Amazon
              SageMaker training jobs and APIs that create Amazon SageMaker
              endpoints use this role to access training data and model
              artifacts. After the endpoint is created, the inference code
              might use the IAM role, if it needs to access an AWS resource.
          entry_point (str): The absolute or relative path to the Python source
              file that should be executed as the entry point to model
              hosting. If ``source_dir`` is specified, then ``entry_point``
              must point to a file located at the root of ``source_dir``.
              Defaults to None.
          transformers_version (str): Transformers version you want to use for
              executing your model training code. Defaults to None. Required
              unless ``image_uri`` is provided.
          tensorflow_version (str): TensorFlow version you want to use for
              executing your inference code. Defaults to ``None``. Required unless
              ``pytorch_version`` is provided. The current supported version is ``2.4.1``.
          pytorch_version (str): PyTorch version you want to use for
              executing your inference code. Defaults to ``None``. Required unless
              ``tensorflow_version`` is provided. The current supported versions are ``1.7.1`` and ``1.6.0``.
          py_version (str): Python version you want to use for executing your
              model training code. Defaults to ``None``. Required unless
              ``image_uri`` is provided.
          image_uri (str or PipelineVariable): A Docker image URI. Defaults to None.
              If not specified, a default image for PyTorch will be used. If ``framework_version``
              or ``py_version`` are ``None``, then ``image_uri`` is required. If
              also ``None``, then a ``ValueError`` will be raised.
          predictor_cls (callable[str, sagemaker.session.Session]): A function
              to call to create a predictor with an endpoint name and
              SageMaker ``Session``. If specified, ``deploy()`` returns the
              result of invoking this function on the created endpoint name.
          model_server_workers (int or PipelineVariable): Optional. The number of
              worker processes used by the inference server. If None, server will use one
              worker per vCPU.
          **kwargs: Keyword arguments passed to the superclass
              :class:`~sagemaker.model.FrameworkModel` and, subsequently, its
              superclass :class:`~sagemaker.model.Model`.
  
      .. tip::
  
          You can find additional parameters for initializing this class at
          :class:`~sagemaker.model.FrameworkModel` and
          :class:`~sagemaker.model.Model`.
      """
      validate_version_or_image_args(
          transformers_version, py_version, image_uri
      )
      _validate_pt_tf_versions(
          pytorch_version=pytorch_version,
          tensorflow_version=tensorflow_version,
          image_uri=image_uri,
      )
      if py_version == "py2":
          raise ValueError(
              "py2 is not supported with HuggingFace images"
          )
      self.framework_version = transformers_version
      self.pytorch_version = pytorch_version
      self.tensorflow_version = tensorflow_version
      self.py_version = py_version
  
      super(HuggingFaceModel, self).__init__(
          model_data,
          image_uri,
          role,
          entry_point,
          predictor_cls=predictor_cls,
          **kwargs,
      )
      self.sagemaker_session = self.sagemaker_session or Session()
  
      self.model_server_workers = model_server_workers
  
imports: from __future__ import absolute_import
  import logging
  from typing import Optional, Union, List, Dict
  import sagemaker
  from sagemaker import image_uris, ModelMetrics
  from sagemaker.deserializers import JSONDeserializer
  from sagemaker.drift_check_baselines import DriftCheckBaselines
  from sagemaker.fw_utils import model_code_key_prefix, validate_version_or_image_args
  from sagemaker.metadata_properties import MetadataProperties
  from sagemaker.model import FrameworkModel, MODEL_SERVER_WORKERS_PARAM_NAME
  from sagemaker.predictor import Predictor
  from sagemaker.serializers import JSONSerializer
  from sagemaker.session import Session
  from sagemaker.utils import to_string, format_tags
  from sagemaker.workflow import is_pipeline_variable
  from sagemaker.workflow.entities import PipelineVariable
label_desc: Use image node_id 1 to create a new HuggingFaceModel object from inherited base classes: FrameworkModel with example: obj = HuggingFaceModel(role, model_data, entry_point, transformers_version, tensorflow_version, pytorch_version, py_version, image_uri, predictor_cls, model_server_workers)