class_docstr: A DJL FasterTransformer SageMaker ``Model``
  
  This can be deployed to a SageMaker ``Endpoint``.
docstr: Initialize a FasterTransformerModel.
  
  Args:
      model_id (str): This is either the HuggingFace Hub model_id, or the Amazon S3 location
          containing the uncompressed model artifacts (i.e. not a tar.gz file).
          The model artifacts are expected to be in HuggingFace pre-trained model
          format (i.e. model should be loadable from the huggingface transformers
          from_pretrained api, and should also include tokenizer configs if applicable).
      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 model artifacts. After the endpoint is created,
          the inference code
          might use the IAM role, if it needs to access an AWS resource.
      tensor_parllel_degree (int): The number of gpus to shard a single instance of the
           model across via tensor_parallelism. This should be set to greater than 1 if the
           size of the model is larger than the memory available on a single GPU on the
           instance. Defaults to None. If not set, no tensor parallel sharding is done.
      **kwargs: Keyword arguments passed to the superclasses
          :class:`~sagemaker.djl_inference.DJLModel`,
          :class:`~sagemaker.model.FrameworkModel`, and
          :class:`~sagemaker.model.Model`
  
  .. tip::
  
      You can find additional parameters for initializing this class at
      :class:`~sagemaker.djl_inference.DJLModel`,
      :class:`~sagemaker.model.FrameworkModel`, and
      :class:`~sagemaker.model.Model`.
docstr_tok: ["Initialize","a","FasterTransformerModel",".","Args",":","model_id","(","str",")",":","This","is","either","the","HuggingFace","Hub","model_id",",","or","the","Amazon","S3","location","containing","the","uncompressed","model","artifacts","(","i.e",".","not","a","tar.gz","file",")",".","The","model","artifacts","are","expected","to","be","in","HuggingFace","pre-trained","model","format","(","i.e",".","model","should","be","loadable","from","the","huggingface","transformers","from_pretrained","api",",","and","should","also","include","tokenizer","configs","if","applicable",")",".","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","model","artifacts",".","After","the","endpoint","is","created",",","the","inference","code","might","use","the","IAM","role",",","if","it","needs","to","access","an","AWS","resource",".","tensor_parllel_degree","(","int",")",":","The","number","of","gpus","to","shard","a","single","instance","of","the","model","across","via","tensor_parallelism",".","This","should","be","set","to","greater","than","1","if","the","size","of","the","model","is","larger","than","the","memory","available","on","a","single","GPU","on","the","instance",".","Defaults","to","None",".","If","not","set",",","no","tensor","parallel","sharding","is","done",".","*","*","kwargs",":","Keyword","arguments","passed","to","the","superclasses",":","class",":","`","~sagemaker.djl_inference.DJLModel","`",",",":","class",":","`","~sagemaker.model.FrameworkModel","`",",","and",":","class",":","`","~sagemaker.model.Model","`","..","tip",":",":","You","can","find","additional","parameters","for","initializing","this","class","at",":","class",":","`","~sagemaker.djl_inference.DJLModel","`",",",":","class",":","`","~sagemaker.model.FrameworkModel","`",",","and",":","class",":","`","~sagemaker.model.Model","`","."]
code: def __init__(
      self,
      model_id: str,
      role: str,
      tensor_parallel_degree: Optional[int] = None,
      **kwargs,
  ):
      """Initialize a FasterTransformerModel.
  
      Args:
          model_id (str): This is either the HuggingFace Hub model_id, or the Amazon S3 location
              containing the uncompressed model artifacts (i.e. not a tar.gz file).
              The model artifacts are expected to be in HuggingFace pre-trained model
              format (i.e. model should be loadable from the huggingface transformers
              from_pretrained api, and should also include tokenizer configs if applicable).
          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 model artifacts. After the endpoint is created,
              the inference code
              might use the IAM role, if it needs to access an AWS resource.
          tensor_parllel_degree (int): The number of gpus to shard a single instance of the
               model across via tensor_parallelism. This should be set to greater than 1 if the
               size of the model is larger than the memory available on a single GPU on the
               instance. Defaults to None. If not set, no tensor parallel sharding is done.
          **kwargs: Keyword arguments passed to the superclasses
              :class:`~sagemaker.djl_inference.DJLModel`,
              :class:`~sagemaker.model.FrameworkModel`, and
              :class:`~sagemaker.model.Model`
  
      .. tip::
  
          You can find additional parameters for initializing this class at
          :class:`~sagemaker.djl_inference.DJLModel`,
          :class:`~sagemaker.model.FrameworkModel`, and
          :class:`~sagemaker.model.Model`.
      """
      if "hf_hub_token" in kwargs:
          kwargs.pop("hf_hub_token")
      super(FasterTransformerModel, self).__init__(
          model_id,
          role,
          **kwargs,
      )
      if self.number_of_partitions and tensor_parallel_degree:
          logger.warning(
              "Both number_of_partitions and tensor_parallel_degree have been set for "
              "FasterTransformerModel."
              "These mean the same thing for FasterTransformerModel. Please only set "
              "tensor_parallel_degree."
              "number_of_partitions will be ignored"
          )
      self.number_of_partitions = (
          tensor_parallel_degree or self.number_of_partitions
      )
  
imports: from __future__ import absolute_import
  import json
  import logging
  import os.path
  import urllib.request
  from json import JSONDecodeError
  from urllib.error import HTTPError, URLError
  from enum import Enum
  from typing import Optional, Union, Dict, Any, List
  import sagemaker
  from sagemaker import s3, Predictor, image_uris, fw_utils
  from sagemaker.deserializers import JSONDeserializer, BaseDeserializer
  from sagemaker.djl_inference import defaults
  from sagemaker.model import FrameworkModel
  from sagemaker.s3_utils import s3_path_join
  from sagemaker.serializers import JSONSerializer, BaseSerializer
  from sagemaker.session import Session
  from sagemaker.utils import _tmpdir, _create_or_update_code_dir, format_tags
  from sagemaker.workflow.entities import PipelineVariable
  from sagemaker.estimator import Estimator
  from sagemaker.s3 import S3Uploader
label_desc: Use image node_id 1 to create a new FasterTransformerModel object from inherited base classes: DJLModel with example: obj = FasterTransformerModel(model_id, role, tensor_parallel_degree)