Skip to content

Commit ae47639

Browse files
Ark-kuncopybara-github
authored andcommitted
feat: GenAI - Tuning - Released the Supervised Fine Tuning feature o GA
PiperOrigin-RevId: 649299220
1 parent f6e7b9c commit ae47639

File tree

3 files changed

+68
-3
lines changed

3 files changed

+68
-3
lines changed

tests/unit/vertexai/test_tuning.py

+18-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@
3434
from google.cloud.aiplatform_v1beta1.types import job_state
3535
from google.cloud.aiplatform_v1beta1.types import tuning_job as gca_tuning_job
3636
from vertexai.preview import tuning
37-
from vertexai.preview.tuning import sft as supervised_tuning
37+
from vertexai.preview.tuning import (
38+
sft as preview_supervised_tuning,
39+
)
40+
from vertexai.tuning import sft as supervised_tuning
3841

3942
import pytest
4043

@@ -169,7 +172,13 @@ def teardown_method(self):
169172
attribute="client_class",
170173
new=MockTuningJobClientWithOverride,
171174
)
172-
def test_genai_tuning_service_supervised_tuning_tune_model(self):
175+
@pytest.mark.parametrize(
176+
"supervised_tuning",
177+
[supervised_tuning, preview_supervised_tuning],
178+
)
179+
def test_genai_tuning_service_supervised_tuning_tune_model(
180+
self, supervised_tuning: supervised_tuning
181+
):
173182
sft_tuning_job = supervised_tuning.train(
174183
source_model="gemini-1.0-pro-001",
175184
train_dataset="gs://some-bucket/some_dataset.jsonl",
@@ -209,7 +218,13 @@ def test_genai_tuning_service_supervised_tuning_tune_model(self):
209218
attribute="client_class",
210219
new=MockTuningJobClientWithOverride,
211220
)
212-
def test_genai_tuning_service_encryption_spec(self):
221+
@pytest.mark.parametrize(
222+
"supervised_tuning",
223+
[supervised_tuning, preview_supervised_tuning],
224+
)
225+
def test_genai_tuning_service_encryption_spec(
226+
self, supervised_tuning: supervised_tuning
227+
):
213228
"""Test that the global encryption spec propagates to the tuning job."""
214229
vertexai.init(encryption_spec_key_name="test-key")
215230

vertexai/tuning/__init__.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
"""Classes for tuning models."""
16+
17+
# We just want to re-export certain classes
18+
# pylint: disable=g-multiple-import,g-importing-member
19+
from vertexai.tuning._tuning import TuningJob
20+
21+
__all__ = [
22+
"TuningJob",
23+
]

vertexai/tuning/sft.py

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
"""Classes for supervised tuning."""
16+
17+
# We just want to re-export certain classes
18+
# pylint: disable=g-multiple-import,g-importing-member
19+
from vertexai.tuning._supervised_tuning import (
20+
train,
21+
SupervisedTuningJob,
22+
)
23+
24+
__all__ = [
25+
"train",
26+
"SupervisedTuningJob",
27+
]

0 commit comments

Comments
 (0)