Skip to content

Commit 28257a1

Browse files
committed
change: renamed is_nova_recipe to is_nova_or_eval_recipe
1 parent f1b1401 commit 28257a1

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

src/sagemaker/pytorch/estimator.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ def __init__(
543543
:class:`~sagemaker.estimator.Framework` and
544544
:class:`~sagemaker.estimator.EstimatorBase`.
545545
"""
546-
self.is_nova_recipe = False
546+
self.is_nova_or_eval_recipe = False
547547
if training_recipe is not None:
548548
if entry_point is not None:
549549
logger.warning("Argument entry_point will be ignored with training_recipe.")
@@ -555,7 +555,7 @@ def __init__(
555555
training_recipe, recipe_overrides, source_dir, kwargs
556556
)
557557

558-
if self.is_nova_recipe and image_uri is None:
558+
if self.is_nova_or_eval_recipe and image_uri is None:
559559
raise ValueError("Must supply image_uri for nova jobs.")
560560

561561
entry_point = args["entry_point"]
@@ -586,7 +586,7 @@ def __init__(
586586
source_dir,
587587
hyperparameters,
588588
image_uri=image_uri,
589-
is_nova_job=self.is_nova_recipe,
589+
is_nova_job=self.is_nova_or_eval_recipe,
590590
**kwargs,
591591
)
592592

@@ -719,8 +719,8 @@ def fit(
719719
"""
720720
# Handle recipe upload and input channel creation if we have a recipe
721721
if (
722-
self.is_nova_recipe is not None
723-
and self.is_nova_recipe
722+
self.is_nova_or_eval_recipe is not None
723+
and self.is_nova_or_eval_recipe
724724
and hasattr(self, "training_recipe_file")
725725
and self.training_recipe_file
726726
):
@@ -1154,8 +1154,8 @@ def _setup_for_training_recipe(self, training_recipe, recipe_overrides, source_d
11541154
# Merge with overrides
11551155
recipe = OmegaConf.merge(recipe, recipe_overrides)
11561156

1157-
self.is_nova_recipe = _is_nova_recipe(recipe) or _is_eval_recipe(recipe)
1158-
if self.is_nova_recipe:
1157+
self.is_nova_or_eval_recipe = _is_nova_recipe(recipe) or _is_eval_recipe(recipe)
1158+
if self.is_nova_or_eval_recipe:
11591159
return self._setup_for_nova_recipe(
11601160
recipe,
11611161
recipe_name,

tests/unit/test_pytorch_nova.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def test_setup_for_nova_recipe_with_model_name(mock_resolve_save, sagemaker_sess
138138
)
139139

140140
# Check that the Nova recipe was correctly identified
141-
assert pytorch.is_nova_recipe is True
141+
assert pytorch.is_nova_or_eval_recipe is True
142142

143143
# Verify _setup_for_nova_recipe was called
144144
mock_nova_setup.assert_called_once()
@@ -194,7 +194,7 @@ def test_setup_for_nova_recipe_with_s3_path(mock_resolve_save, sagemaker_session
194194
)
195195

196196
# Check that the Nova recipe was correctly identified
197-
assert pytorch.is_nova_recipe is True
197+
assert pytorch.is_nova_or_eval_recipe is True
198198

199199
# Verify _setup_for_nova_recipe was called
200200
mock_nova_setup.assert_called_once()
@@ -326,7 +326,7 @@ def test_upload_recipe_to_s3(mock_time, mock_recipe_load, sagemaker_session):
326326
)
327327

328328
# Set Nova recipe attributes
329-
pytorch.is_nova_recipe = True
329+
pytorch.is_nova_or_eval_recipe = True
330330

331331
# Create a temporary file to use as the recipe file
332332
with tempfile.NamedTemporaryFile(suffix=".yaml") as temp_file:
@@ -369,7 +369,7 @@ def test_recipe_resolve_and_save(
369369
)
370370

371371
# Set Nova recipe attributes
372-
pytorch.is_nova_recipe = True
372+
pytorch.is_nova_or_eval_recipe = True
373373

374374
# Mock the temporary file
375375
mock_temp_file_instance = Mock()
@@ -421,7 +421,7 @@ def test_fit_with_nova_recipe_s3_upload(mock_framework_fit, mock_recipe_load, sa
421421
)
422422

423423
# Set Nova recipe attributes
424-
pytorch.is_nova_recipe = True
424+
pytorch.is_nova_or_eval_recipe = True
425425
pytorch.training_recipe_file = temp_file
426426

427427
# Mock the _upload_recipe_to_s3 method
@@ -473,7 +473,7 @@ def test_fit_with_nova_recipe_and_inputs(
473473
)
474474

475475
# Set Nova recipe attributes
476-
pytorch.is_nova_recipe = True
476+
pytorch.is_nova_or_eval_recipe = True
477477
pytorch.training_recipe_file = temp_file
478478

479479
# Create training inputs
@@ -559,7 +559,7 @@ def test_fit_with_nova_recipe(
559559
)
560560

561561
# Set Nova recipe attributes
562-
pytorch.is_nova_recipe = True
562+
pytorch.is_nova_or_eval_recipe = True
563563
pytorch.training_recipe_file = temp_file
564564

565565
# Mock the upload_recipe_to_s3 method
@@ -642,7 +642,7 @@ def test_framework_set_hyperparameters_non_nova():
642642
py_version="py3",
643643
image_uri=IMAGE_URI,
644644
)
645-
framework.is_nova_recipe = False
645+
framework.is_nova_or_eval_recipe = False
646646

647647
# Add hyperparameters
648648
framework.set_hyperparameters(string_param="string_value", int_param=42, bool_param=True)
@@ -719,7 +719,7 @@ def test_setup_for_nova_recipe_with_evaluation_lambda(mock_resolve_save, sagemak
719719
)
720720

721721
# Check that the Nova recipe was correctly identified
722-
assert pytorch.is_nova_recipe is True
722+
assert pytorch.is_nova_or_eval_recipe is True
723723

724724
# Verify that eval_lambda_arn hyperparameter was set correctly
725725
assert (
@@ -780,7 +780,7 @@ def test_setup_for_nova_recipe_with_distillation(mock_resolve_save, sagemaker_se
780780
)
781781

782782
# Check that the Nova recipe was correctly identified
783-
assert pytorch.is_nova_recipe is True
783+
assert pytorch.is_nova_or_eval_recipe is True
784784

785785
# Verify _setup_for_nova_recipe was called
786786
mock_nova_setup.assert_called_once()
@@ -828,7 +828,7 @@ def test_setup_for_nova_recipe_sets_model_type(mock_resolve_save, sagemaker_sess
828828
)
829829

830830
# Check that the Nova recipe was correctly identified
831-
assert pytorch.is_nova_recipe is True
831+
assert pytorch.is_nova_or_eval_recipe is True
832832

833833
# Verify that model_type hyperparameter was set correctly
834834
assert pytorch._hyperparameters.get("model_type") == "amazon.nova.llama-2-7b"

0 commit comments

Comments
 (0)