@@ -1638,6 +1638,56 @@ def test_tune_text_generation_model_ga(
1638
1638
== test_constants .EndpointConstants ._TEST_ENDPOINT_NAME
1639
1639
)
1640
1640
1641
+ @pytest .mark .parametrize (
1642
+ "job_spec" ,
1643
+ [_TEST_PIPELINE_SPEC_JSON ],
1644
+ )
1645
+ @pytest .mark .parametrize (
1646
+ "mock_request_urlopen" ,
1647
+ ["https://us-central1-kfp.pkg.dev/proj/repo/pack/latest" ],
1648
+ indirect = True ,
1649
+ )
1650
+ def test_tune_text_generation_model_evaluation_with_only_tensorboard (
1651
+ self ,
1652
+ mock_pipeline_service_create ,
1653
+ mock_pipeline_job_get ,
1654
+ mock_pipeline_bucket_exists ,
1655
+ job_spec ,
1656
+ mock_load_yaml_and_json ,
1657
+ mock_gcs_from_string ,
1658
+ mock_gcs_upload ,
1659
+ mock_request_urlopen ,
1660
+ mock_get_tuned_model ,
1661
+ ):
1662
+ """Tests tuning the text generation model."""
1663
+ with mock .patch .object (
1664
+ target = model_garden_service_client .ModelGardenServiceClient ,
1665
+ attribute = "get_publisher_model" ,
1666
+ return_value = gca_publisher_model .PublisherModel (
1667
+ _TEXT_BISON_PUBLISHER_MODEL_DICT
1668
+ ),
1669
+ ):
1670
+ model = language_models .TextGenerationModel .from_pretrained (
1671
+ "text-bison@001"
1672
+ )
1673
+
1674
+ tuning_job_location = "europe-west4"
1675
+ tensorboard_name = f"projects/{ _TEST_PROJECT } /locations/{ tuning_job_location } /tensorboards/123"
1676
+
1677
+ model .tune_model (
1678
+ training_data = _TEST_TEXT_BISON_TRAINING_DF ,
1679
+ tuning_job_location = tuning_job_location ,
1680
+ tuned_model_location = "us-central1" ,
1681
+ tuning_evaluation_spec = preview_language_models .TuningEvaluationSpec (
1682
+ tensorboard = tensorboard_name ,
1683
+ ),
1684
+ )
1685
+ call_kwargs = mock_pipeline_service_create .call_args [1 ]
1686
+ pipeline_arguments = call_kwargs [
1687
+ "pipeline_job"
1688
+ ].runtime_config .parameter_values
1689
+ assert pipeline_arguments ["tensorboard_resource_id" ] == tensorboard_name
1690
+
1641
1691
@pytest .mark .parametrize (
1642
1692
"job_spec" ,
1643
1693
[_TEST_PIPELINE_SPEC_JSON ],
0 commit comments