1717from sagemaker .jumpstart .types import (
1818 JumpStartBenchmarkStat ,
1919 JumpStartECRSpecs ,
20+ JumpStartEnvironmentVariable ,
2021 JumpStartHyperparameter ,
2122 JumpStartInstanceTypeVariants ,
2223 JumpStartModelSpecs ,
@@ -927,6 +928,7 @@ def test_inference_configs_parsing():
927928 "neuron-inference" ,
928929 "neuron-budget" ,
929930 "gpu-inference" ,
931+ "gpu-inference-model-package" ,
930932 "gpu-inference-budget" ,
931933 ]
932934
@@ -1019,6 +1021,80 @@ def test_inference_configs_parsing():
10191021 }
10201022 ),
10211023 ]
1024+ assert specs1 .inference_environment_variables == [
1025+ JumpStartEnvironmentVariable (
1026+ {
1027+ "name" : "SAGEMAKER_PROGRAM" ,
1028+ "type" : "text" ,
1029+ "default" : "inference.py" ,
1030+ "scope" : "container" ,
1031+ "required_for_model_class" : True ,
1032+ }
1033+ ),
1034+ JumpStartEnvironmentVariable (
1035+ {
1036+ "name" : "SAGEMAKER_SUBMIT_DIRECTORY" ,
1037+ "type" : "text" ,
1038+ "default" : "/opt/ml/model/code" ,
1039+ "scope" : "container" ,
1040+ "required_for_model_class" : False ,
1041+ }
1042+ ),
1043+ JumpStartEnvironmentVariable (
1044+ {
1045+ "name" : "SAGEMAKER_CONTAINER_LOG_LEVEL" ,
1046+ "type" : "text" ,
1047+ "default" : "20" ,
1048+ "scope" : "container" ,
1049+ "required_for_model_class" : False ,
1050+ }
1051+ ),
1052+ JumpStartEnvironmentVariable (
1053+ {
1054+ "name" : "SAGEMAKER_MODEL_SERVER_TIMEOUT" ,
1055+ "type" : "text" ,
1056+ "default" : "3600" ,
1057+ "scope" : "container" ,
1058+ "required_for_model_class" : False ,
1059+ }
1060+ ),
1061+ JumpStartEnvironmentVariable (
1062+ {
1063+ "name" : "ENDPOINT_SERVER_TIMEOUT" ,
1064+ "type" : "int" ,
1065+ "default" : 3600 ,
1066+ "scope" : "container" ,
1067+ "required_for_model_class" : True ,
1068+ }
1069+ ),
1070+ JumpStartEnvironmentVariable (
1071+ {
1072+ "name" : "MODEL_CACHE_ROOT" ,
1073+ "type" : "text" ,
1074+ "default" : "/opt/ml/model" ,
1075+ "scope" : "container" ,
1076+ "required_for_model_class" : True ,
1077+ }
1078+ ),
1079+ JumpStartEnvironmentVariable (
1080+ {
1081+ "name" : "SAGEMAKER_ENV" ,
1082+ "type" : "text" ,
1083+ "default" : "1" ,
1084+ "scope" : "container" ,
1085+ "required_for_model_class" : True ,
1086+ }
1087+ ),
1088+ JumpStartEnvironmentVariable (
1089+ {
1090+ "name" : "SAGEMAKER_MODEL_SERVER_WORKERS" ,
1091+ "type" : "int" ,
1092+ "default" : 1 ,
1093+ "scope" : "container" ,
1094+ "required_for_model_class" : True ,
1095+ }
1096+ ),
1097+ ]
10221098
10231099 # Overrided fields in top config
10241100 assert specs1 .supported_inference_instance_types == ["ml.inf2.xlarge" , "ml.inf2.2xlarge" ]
@@ -1057,6 +1133,20 @@ def test_inference_configs_parsing():
10571133 )
10581134 assert list (config .config_components .keys ()) == ["neuron-inference" ]
10591135
1136+ config = specs1 .inference_configs .configs ["gpu-inference-model-package" ]
1137+ assert config .config_components ["gpu-inference-model-package" ] == JumpStartConfigComponent (
1138+ "gpu-inference-model-package" ,
1139+ {
1140+ "default_inference_instance_type" : "ml.p2.xlarge" ,
1141+ "supported_inference_instance_types" : ["ml.p2.xlarge" , "ml.p3.2xlarge" ],
1142+ "hosting_model_package_arns" : {
1143+ "us-west-2" : "arn:aws:sagemaker:us-west-2:594846645681:model-package/"
1144+ "llama2-7b-v3-740347e540da35b4ab9f6fc0ab3fed2c"
1145+ },
1146+ },
1147+ )
1148+ assert config .resolved_config .get ("inference_environment_variables" ) == []
1149+
10601150 spec = {
10611151 ** BASE_SPEC ,
10621152 ** INFERENCE_CONFIGS ,
@@ -1075,6 +1165,7 @@ def test_set_inference_configs():
10751165 "neuron-inference" ,
10761166 "neuron-budget" ,
10771167 "gpu-inference" ,
1168+ "gpu-inference-model-package" ,
10781169 "gpu-inference-budget" ,
10791170 ]
10801171
@@ -1083,7 +1174,7 @@ def test_set_inference_configs():
10831174 assert "Cannot find Jumpstart config name invalid_name."
10841175 "List of config names that is supported by the model: "
10851176 "['neuron-inference', 'neuron-inference-budget', "
1086- "'gpu-inference-budget', 'gpu-inference']" in str (error .value )
1177+ "'gpu-inference-budget', 'gpu-inference', 'gpu-inference-model-package' ]" in str (error .value )
10871178
10881179 assert specs1 .supported_inference_instance_types == ["ml.inf2.xlarge" , "ml.inf2.2xlarge" ]
10891180 specs1 .set_config ("gpu-inference" )
0 commit comments