@@ -684,6 +684,50 @@ def test_framework_hyperparameters_nova():
684684 assert hyperparams ["bool_param" ] == "true"
685685
686686
687+ @patch ("sagemaker.pytorch.estimator.PyTorch._recipe_resolve_and_save" )
688+ def test_setup_for_nova_recipe_with_evaluation_lambda (mock_resolve_save , sagemaker_session ):
689+ """Test that _setup_for_nova_recipe correctly handles evaluation lambda configuration."""
690+ # Create a mock recipe with evaluation and processor config
691+ recipe = OmegaConf .create (
692+ {
693+ "run" : {
694+ "model_type" : "amazon.nova.foobar3" ,
695+ "model_name_or_path" : "foobar/foobar-3-8b" ,
696+ "replicas" : 1 ,
697+ },
698+ "evaluation" : {"task:" : "gen_qa" , "strategy" : "gen_qa" , "metric" : "all" },
699+ "processor" : {
700+ "lambda_arn" : "arn:aws:lambda:us-west-2:123456789012:function:eval-function"
701+ },
702+ }
703+ )
704+
705+ with patch (
706+ "sagemaker.pytorch.estimator.PyTorch._recipe_load" , return_value = ("nova_recipe" , recipe )
707+ ):
708+ mock_resolve_save .return_value = recipe
709+
710+ pytorch = PyTorch (
711+ training_recipe = "nova_recipe" ,
712+ role = ROLE ,
713+ sagemaker_session = sagemaker_session ,
714+ instance_count = INSTANCE_COUNT ,
715+ instance_type = INSTANCE_TYPE_GPU ,
716+ image_uri = IMAGE_URI ,
717+ framework_version = "1.13.1" ,
718+ py_version = "py3" ,
719+ )
720+
721+ # Check that the Nova recipe was correctly identified
722+ assert pytorch .is_nova_recipe is True
723+
724+ # Verify that eval_lambda_arn hyperparameter was set correctly
725+ assert (
726+ pytorch ._hyperparameters .get ("eval_lambda_arn" )
727+ == "arn:aws:lambda:us-west-2:123456789012:function:eval-function"
728+ )
729+
730+
687731@patch ("sagemaker.pytorch.estimator.PyTorch._recipe_resolve_and_save" )
688732def test_setup_for_nova_recipe_with_distillation (mock_resolve_save , sagemaker_session ):
689733 """Test that _setup_for_nova_recipe correctly handles distillation configurations."""
0 commit comments