16
16
17
17
from typing import List
18
18
19
- from vertexai .preview . tuning import sft
19
+ from vertexai .tuning import sft
20
20
21
21
22
22
PROJECT_ID = os .getenv ("GOOGLE_CLOUD_PROJECT" )
@@ -29,14 +29,14 @@ def gemini_tuning_basic() -> sft.SupervisedTuningJob:
29
29
import time
30
30
31
31
import vertexai
32
- from vertexai .preview . tuning import sft
32
+ from vertexai .tuning import sft
33
33
34
34
# TODO(developer): Update project_id and location
35
35
vertexai .init (project = PROJECT_ID , location = "us-central1" )
36
36
37
37
sft_tuning_job = sft .train (
38
- source_model = "gemini-1.0 -pro-002" ,
39
- train_dataset = "gs://cloud-samples-data/ai-platform/generative_ai/sft_train_data.jsonl" ,
38
+ source_model = "gemini-1.5 -pro-002" ,
39
+ train_dataset = "gs://cloud-samples-data/ai-platform/generative_ai/gemini-1_5/text/ sft_train_data.jsonl" ,
40
40
)
41
41
42
42
# Polling for job completion
@@ -58,20 +58,20 @@ def gemini_tuning_advanced() -> sft.SupervisedTuningJob:
58
58
import time
59
59
60
60
import vertexai
61
- from vertexai .preview . tuning import sft
61
+ from vertexai .tuning import sft
62
62
63
63
# TODO(developer): Update project_id and location
64
64
vertexai .init (project = PROJECT_ID , location = "us-central1" )
65
65
66
66
sft_tuning_job = sft .train (
67
- source_model = "gemini-1.0 -pro-002" ,
68
- train_dataset = "gs://cloud-samples-data/ai-platform/generative_ai/sft_train_data.jsonl" ,
67
+ source_model = "gemini-1.5 -pro-002" ,
68
+ train_dataset = "gs://cloud-samples-data/ai-platform/generative_ai/gemini-1_5/text/ sft_train_data.jsonl" ,
69
69
# The following parameters are optional
70
- validation_dataset = "gs://cloud-samples-data/ai-platform/generative_ai/sft_validation_data.jsonl" ,
70
+ validation_dataset = "gs://cloud-samples-data/ai-platform/generative_ai/gemini-1_5/text/ sft_validation_data.jsonl" ,
71
71
epochs = 4 ,
72
72
adapter_size = 4 ,
73
73
learning_rate_multiplier = 1.0 ,
74
- tuned_model_display_name = "tuned_gemini_pro " ,
74
+ tuned_model_display_name = "tuned_gemini_1_5_pro " ,
75
75
)
76
76
77
77
# Polling for job completion
@@ -90,7 +90,7 @@ def gemini_tuning_advanced() -> sft.SupervisedTuningJob:
90
90
def get_tuning_job () -> sft .SupervisedTuningJob :
91
91
# [START generativeaionvertexai_get_tuning_job]
92
92
import vertexai
93
- from vertexai .preview . tuning import sft
93
+ from vertexai .tuning import sft
94
94
95
95
# TODO(developer): Update project_id and location
96
96
vertexai .init (project = PROJECT_ID , location = LOCATION )
@@ -109,7 +109,7 @@ def get_tuning_job() -> sft.SupervisedTuningJob:
109
109
def list_tuning_jobs () -> List [sft .SupervisedTuningJob ]:
110
110
# [START generativeaionvertexai_list_tuning_jobs]
111
111
import vertexai
112
- from vertexai .preview . tuning import sft
112
+ from vertexai .tuning import sft
113
113
114
114
# TODO(developer): Update project_id and location
115
115
vertexai .init (project = PROJECT_ID , location = "us-central1" )
@@ -126,7 +126,7 @@ def list_tuning_jobs() -> List[sft.SupervisedTuningJob]:
126
126
def cancel_tuning_job () -> None :
127
127
# [START generativeaionvertexai_cancel_tuning_job]
128
128
import vertexai
129
- from vertexai .preview . tuning import sft
129
+ from vertexai .tuning import sft
130
130
131
131
# TODO(developer): Update project, location
132
132
vertexai .init (project = PROJECT_ID , location = LOCATION )
0 commit comments