code: def test_jumpstart_sdk_environment_variables_instance_type_overrides(
      patched_get_model_specs,
  ):
      patched_get_model_specs.side_effect = get_special_model_spec
  
      model_id = "env-var-variant-model"
      region = "us-west-2"
  
      # assert that we can override default environment variables
      vars = environment_variables.retrieve_default(
          region=region,
          model_id=model_id,
          model_version="*",
          include_aws_sdk_env_vars=False,
          sagemaker_session=mock_session,
          instance_type="ml.g5.48xlarge",
      )
      assert vars == {
          "ENDPOINT_SERVER_TIMEOUT": "3600",
          "HF_MODEL_ID": "/opt/ml/model",
          "MAX_INPUT_LENGTH": "1024",
          "MAX_TOTAL_TOKENS": "2048",
          "MODEL_CACHE_ROOT": "/opt/ml/model",
          "SAGEMAKER_ENV": "1",
          "SAGEMAKER_MODEL_SERVER_WORKERS": "1",
          "SAGEMAKER_PROGRAM": "inference.py",
          "SM_NUM_GPUS": "80",
      }
  
      # assert that we can add environment variables
      vars = environment_variables.retrieve_default(
          region=region,
          model_id=model_id,
          model_version="*",
          include_aws_sdk_env_vars=False,
          sagemaker_session=mock_session,
          instance_type="ml.p4d.24xlarge",
      )
      assert vars == {
          "ENDPOINT_SERVER_TIMEOUT": "3600",
          "HF_MODEL_ID": "/opt/ml/model",
          "MAX_INPUT_LENGTH": "1024",
          "MAX_TOTAL_TOKENS": "2048",
          "MODEL_CACHE_ROOT": "/opt/ml/model",
          "SAGEMAKER_ENV": "1",
          "SAGEMAKER_MODEL_SERVER_WORKERS": "1",
          "SAGEMAKER_PROGRAM": "inference.py",
          "SM_NUM_GPUS": "8",
          "YODEL": "NACEREMA",
      }
  
      # assert that we can return default env variables for unrecognized instance
      vars = environment_variables.retrieve_default(
          region=region,
          model_id=model_id,
          model_version="*",
          include_aws_sdk_env_vars=False,
          sagemaker_session=mock_session,
          instance_type="ml.p002.xlarge",
      )
      assert vars == {
          "ENDPOINT_SERVER_TIMEOUT": "3600",
          "HF_MODEL_ID": "/opt/ml/model",
          "MAX_INPUT_LENGTH": "1024",
          "MAX_TOTAL_TOKENS": "2048",
          "MODEL_CACHE_ROOT": "/opt/ml/model",
          "SAGEMAKER_ENV": "1",
          "SAGEMAKER_MODEL_SERVER_WORKERS": "1",
          "SAGEMAKER_PROGRAM": "inference.py",
          "SM_NUM_GPUS": "8",
      }
  
file_path: sagemaker-python-sdk/tests/unit/sagemaker/environment_variables/jumpstart/test_default.py
imports: from __future__ import absolute_import
  import boto3
  from mock.mock import patch, Mock
  import pytest
  from sagemaker import environment_variables
  from tests.unit.sagemaker.jumpstart.utils import get_spec_from_base_spec, get_special_model_spec
label_desc: Use image node_id 3 for calling a global function with example usage: test_jumpstart_sdk_environment_variables_instance_type_overrides(patched_get_model_specs) without return types