class_docstr: Handle training of custom HuggingFace code.
class_docstr_tok: ["Handle","training","of","custom","HuggingFace","code","."]
docstr: Returns a dict of distribution config for Hugging Face training
  
  Args:
      distribution (dict): A dictionary with information on how to run distributed training.
  Returns:
      dict containing Pytorch DDP config
docstr_tok: ["Returns","a","dict","of","distribution","config","for","Hugging","Face","training","Args",":","distribution","(","dict",")",":","A","dictionary","with","information","on","how","to","run","distributed","training",".","Returns",":","dict","containing","Pytorch","DDP","config"]
code: def _huggingface_distribution_configuration(self, distribution):
      """Returns a dict of distribution config for Hugging Face training
  
      Args:
          distribution (dict): A dictionary with information on how to run distributed training.
      Returns:
          dict containing Pytorch DDP config
      """
      distribution_config = {}
      pytorch_ddp_enabled = False
      torch_distributed_enabled = False
  
      if "pytorchddp" in distribution:
          pytorch_ddp_enabled = distribution.get("pytorchddp").get(
              "enabled", False
          )
      elif "torch_distributed" in distribution:
          torch_distributed_enabled = distribution.get(
              "torch_distributed"
          ).get("enabled", False)
  
      if pytorch_ddp_enabled:
          distribution_config[
              self.LAUNCH_PYTORCH_DDP_ENV_NAME
          ] = pytorch_ddp_enabled
          if self.instance_type is not None:
              distribution_config[
                  self.INSTANCE_TYPE_ENV_NAME
              ] = self.instance_type
      elif torch_distributed_enabled:
          distribution_config[
              self.LAUNCH_TORCH_DISTRIBUTED_ENV_NAME
          ] = torch_distributed_enabled
          if self.instance_type is not None:
              distribution_config[
                  self.INSTANCE_TYPE_ENV_NAME
              ] = self.instance_type
      else:
          distribution_config = self._distribution_configuration(
              distribution=distribution
          )
  
      return distribution_config
  
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 3 for calling the HuggingFace obj's underlying member method code with example usage: obj._huggingface_distribution_configuration(distribution) and returns: distribution_config