@@ -633,64 +633,6 @@ def test_tuning_tf_script_mode(
633
633
tuner .wait ()
634
634
635
635
636
- # TODO: evaluate skip mark and default framework_version 1.11
637
- @pytest .mark .canary_quick
638
- @pytest .mark .skipif (PYTHON_VERSION != "py2" , reason = "TensorFlow image supports only python 2." )
639
- def test_tuning_tf (sagemaker_session , cpu_instance_type ):
640
- with timeout (minutes = TUNING_DEFAULT_TIMEOUT_MINUTES ):
641
- script_path = os .path .join (DATA_DIR , "iris" , "iris-dnn-classifier.py" )
642
-
643
- estimator = TensorFlow (
644
- entry_point = script_path ,
645
- role = "SageMakerRole" ,
646
- training_steps = 1 ,
647
- evaluation_steps = 1 ,
648
- hyperparameters = {"input_tensor_name" : "inputs" },
649
- train_instance_count = 1 ,
650
- train_instance_type = cpu_instance_type ,
651
- sagemaker_session = sagemaker_session ,
652
- framework_version = "1.11" ,
653
- py_version = PYTHON_VERSION ,
654
- )
655
-
656
- inputs = sagemaker_session .upload_data (path = DATA_PATH , key_prefix = "integ-test-data/tf_iris" )
657
- hyperparameter_ranges = {"learning_rate" : ContinuousParameter (0.05 , 0.2 )}
658
-
659
- objective_metric_name = "loss"
660
- metric_definitions = [{"Name" : "loss" , "Regex" : "loss = ([0-9\\ .]+)" }]
661
-
662
- tuner = HyperparameterTuner (
663
- estimator ,
664
- objective_metric_name ,
665
- hyperparameter_ranges ,
666
- metric_definitions ,
667
- objective_type = "Minimize" ,
668
- max_jobs = 2 ,
669
- max_parallel_jobs = 2 ,
670
- )
671
-
672
- tuning_job_name = unique_name_from_base ("tune-tf" , max_length = 32 )
673
- tuner .fit (inputs , job_name = tuning_job_name )
674
-
675
- print ("Started hyperparameter tuning job with name:" + tuning_job_name )
676
-
677
- time .sleep (15 )
678
- tuner .wait ()
679
-
680
- best_training_job = tuner .best_training_job ()
681
- with timeout_and_delete_endpoint_by_name (best_training_job , sagemaker_session ):
682
- predictor = tuner .deploy (1 , cpu_instance_type )
683
-
684
- features = [6.4 , 3.2 , 4.5 , 1.5 ]
685
- dict_result = predictor .predict ({"inputs" : features })
686
- print ("predict result: {}" .format (dict_result ))
687
- list_result = predictor .predict (features )
688
- print ("predict result: {}" .format (list_result ))
689
-
690
- assert dict_result == list_result
691
-
692
-
693
- # TODO: evaluate skip mark and default framework_version 1.11
694
636
@pytest .mark .skipif (PYTHON_VERSION != "py2" , reason = "TensorFlow image supports only python 2." )
695
637
def test_tuning_tf_vpc_multi (sagemaker_session , cpu_instance_type ):
696
638
"""Test Tensorflow multi-instance using the same VpcConfig for training and inference"""
0 commit comments