code: def test_attach(
      sagemaker_session,
      compiler_enabled,
      debug_enabled,
      huggingface_training_compiler_tensorflow_py_version,
  ):
      training_image = (
          f"1.dkr.ecr.us-east-1.amazonaws.com/huggingface-tensorflow-trcomp-training:"
          f"2.6.3-"
          f"transformers4.17.0-gpu-"
          f"{huggingface_training_compiler_tensorflow_py_version}-cu112-ubuntu20.04"
      )
      returned_job_description = {
          "AlgorithmSpecification": {
              "TrainingInputMode": "File",
              "TrainingImage": training_image,
          },
          "HyperParameters": {
              "sagemaker_submit_directory": '"s3://some/sourcedir.tar.gz"',
              "sagemaker_program": '"iris-dnn-classifier.py"',
              "sagemaker_s3_uri_training": '"sagemaker-3/integ-test-data/tf_iris"',
              "sagemaker_container_log_level": '"logging.INFO"',
              "sagemaker_job_name": '"trcomp"',
              "training_steps": "100",
              "sagemaker_region": '"us-east-1"',
              TrainingCompilerConfig.HP_ENABLE_COMPILER: json.dumps(
                  compiler_enabled
              ),
              TrainingCompilerConfig.HP_ENABLE_DEBUG: json.dumps(
                  debug_enabled
              ),
          },
          "RoleArn": "arn:aws:iam::366:role/SageMakerRole",
          "ResourceConfig": {
              "VolumeSizeInGB": 30,
              "InstanceCount": 1,
              "InstanceType": "ml.p3.2xlarge",
          },
          "StoppingCondition": {"MaxRuntimeInSeconds": 24 * 60 * 60},
          "TrainingJobName": "trcomp",
          "TrainingJobStatus": "Completed",
          "TrainingJobArn": "arn:aws:sagemaker:us-west-2:336:training-job/trcomp",
          "OutputDataConfig": {
              "KmsKeyId": "",
              "S3OutputPath": "s3://place/output/trcomp",
          },
          "TrainingJobOutput": {
              "S3TrainingJobOutput": "s3://here/output.tar.gz"
          },
      }
      sagemaker_session.sagemaker_client.describe_training_job = Mock(
          name="describe_training_job",
          return_value=returned_job_description,
      )
  
      estimator = HuggingFace.attach(
          training_job_name="trcomp",
          sagemaker_session=sagemaker_session,
      )
      assert estimator.latest_training_job.job_name == "trcomp"
      assert (
          estimator.py_version
          == huggingface_training_compiler_tensorflow_py_version
      )
      assert estimator.framework_version == "4.17.0"
      assert estimator.tensorflow_version == "2.6.3"
      assert estimator.role == "arn:aws:iam::366:role/SageMakerRole"
      assert estimator.instance_count == 1
      assert estimator.max_run == 24 * 60 * 60
      assert estimator.input_mode == "File"
      assert estimator.base_job_name == "trcomp"
      assert estimator.output_path == "s3://place/output/trcomp"
      assert estimator.output_kms_key == ""
      assert estimator.hyperparameters()["training_steps"] == "100"
      assert estimator.hyperparameters()[
          TrainingCompilerConfig.HP_ENABLE_COMPILER
      ] == json.dumps(compiler_enabled)
      assert estimator.hyperparameters()[
          TrainingCompilerConfig.HP_ENABLE_DEBUG
      ] == json.dumps(debug_enabled)
      assert estimator.source_dir == "s3://some/sourcedir.tar.gz"
      assert estimator.entry_point == "iris-dnn-classifier.py"
  
imports: from __future__ import absolute_import
  import logging
  import json
  import os
  import pytest
  from mock import MagicMock, Mock, patch, ANY
  from sagemaker import image_uris
  from sagemaker.huggingface import HuggingFace, TrainingCompilerConfig
  from sagemaker.huggingface.model import HuggingFaceModel
  from sagemaker.session_settings import SessionSettings
  from tests.unit.sagemaker.training_compiler import EC2_GPU_INSTANCE_CLASSES
label_desc: Use image node_id 15 for calling a global function with example usage: test_attach(sagemaker_session, compiler_enabled, debug_enabled, huggingface_training_compiler_tensorflow_py_version) without return types