class_docstr: Handle training of custom HuggingFace code.
class_docstr_tok: ["Handle","training","of","custom","HuggingFace","code","."]
docstr: Convert the job description to init params that can be handled by the class constructor.
  
  Args:
      job_details: The returned job details from a describe_training_job
          API call.
      model_channel_name (str): Name of the channel where pre-trained
          model data will be downloaded.
  
  Returns:
      dictionary: The transformed init_params
docstr_tok: ["Convert","the","job","description","to","init","params","that","can","be","handled","by","the","class","constructor",".","Args",":","job_details",":","The","returned","job","details","from","a","describe_training_job","API","call",".","model_channel_name","(","str",")",":","Name","of","the","channel","where","pre-trained","model","data","will","be","downloaded",".","Returns",":","dictionary",":","The","transformed","init_params"]
code: def _prepare_init_params_from_job_description(
      cls, job_details, model_channel_name=None
  ):
      """Convert the job description to init params that can be handled by the class constructor.
  
      Args:
          job_details: The returned job details from a describe_training_job
              API call.
          model_channel_name (str): Name of the channel where pre-trained
              model data will be downloaded.
  
      Returns:
          dictionary: The transformed init_params
      """
      init_params = super(
          HuggingFace, cls
      )._prepare_init_params_from_job_description(
          job_details, model_channel_name
      )
      image_uri = init_params.pop("image_uri")
      framework, py_version, tag, _ = framework_name_from_image(
          image_uri
      )
  
      if tag is None:
          framework_version = None
      else:
          framework, pt_or_tf = framework.split("-")[:2]
          tag_pattern = re.compile(
              r"^(.*)-transformers(.*)-(cpu|gpu)-(py2|py3\d*)$"
          )
          tag_match = tag_pattern.match(tag)
          pt_or_tf_version = tag_match.group(1)
          framework_version = tag_match.group(2)
          if pt_or_tf == "pytorch":
              init_params["pytorch_version"] = pt_or_tf_version
          else:
              init_params["tensorflow_version"] = pt_or_tf_version
  
      init_params["transformers_version"] = framework_version
      init_params["py_version"] = py_version
  
      if not framework:
          # If we were unable to parse the framework name from the image it is not one of our
          # officially supported images, in this case just add the image to the init params.
          init_params["image_uri"] = image_uri
          return init_params
  
      if framework != cls._framework_name:
          raise ValueError(
              "Training job: {} didn't use image for requested framework".format(
                  job_details["TrainingJobName"]
              )
          )
  
      return init_params
  
file_path: sagemaker-python-sdk/src/sagemaker/huggingface/estimator.py
imports: from __future__ import absolute_import
  import logging
  import re
  from typing import Optional, Union, Dict
  from sagemaker.estimator import Framework, EstimatorBase
  from sagemaker.fw_utils import framework_name_from_image, validate_distribution
  from sagemaker.huggingface.model import HuggingFaceModel
  from sagemaker.vpc_utils import VPC_CONFIG_DEFAULT
  from sagemaker.huggingface.training_compiler.config import TrainingCompilerConfig
  from sagemaker.workflow.entities import PipelineVariable
label_desc: Use image node_id 6 for calling the HuggingFace obj's underlying member method code with example usage: obj._prepare_init_params_from_job_description(cls, job_details, model_channel_name) and returns: init_params, init_params