google-genai 1.38.0__py3-none-any.whl → 1.39.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- google/genai/_api_client.py +29 -0
- google/genai/_common.py +25 -10
- google/genai/_live_converters.py +2074 -1924
- google/genai/_operations_converters.py +108 -117
- google/genai/_replay_api_client.py +8 -4
- google/genai/_tokens_converters.py +465 -458
- google/genai/_transformers.py +44 -26
- google/genai/batches.py +1101 -1138
- google/genai/caches.py +747 -771
- google/genai/client.py +87 -0
- google/genai/files.py +110 -123
- google/genai/local_tokenizer.py +7 -2
- google/genai/models.py +2716 -2814
- google/genai/operations.py +10 -22
- google/genai/tunings.py +358 -391
- google/genai/types.py +192 -4
- google/genai/version.py +1 -1
- {google_genai-1.38.0.dist-info → google_genai-1.39.1.dist-info}/METADATA +82 -1
- google_genai-1.39.1.dist-info/RECORD +39 -0
- google_genai-1.38.0.dist-info/RECORD +0 -39
- {google_genai-1.38.0.dist-info → google_genai-1.39.1.dist-info}/WHEEL +0 -0
- {google_genai-1.38.0.dist-info → google_genai-1.39.1.dist-info}/licenses/LICENSE +0 -0
- {google_genai-1.38.0.dist-info → google_genai-1.39.1.dist-info}/top_level.txt +0 -0
google/genai/tunings.py
CHANGED
@@ -32,57 +32,36 @@ from .pagers import AsyncPager, Pager
|
|
32
32
|
logger = logging.getLogger('google_genai.tunings')
|
33
33
|
|
34
34
|
|
35
|
-
def
|
35
|
+
def _AutoraterConfig_from_vertex(
|
36
36
|
from_object: Union[dict[str, Any], object],
|
37
37
|
parent_object: Optional[dict[str, Any]] = None,
|
38
38
|
) -> dict[str, Any]:
|
39
39
|
to_object: dict[str, Any] = {}
|
40
|
-
if getv(from_object, ['
|
41
|
-
setv(to_object, ['
|
40
|
+
if getv(from_object, ['samplingCount']) is not None:
|
41
|
+
setv(to_object, ['sampling_count'], getv(from_object, ['samplingCount']))
|
42
42
|
|
43
|
-
if getv(from_object, ['
|
44
|
-
setv(to_object, ['
|
43
|
+
if getv(from_object, ['flipEnabled']) is not None:
|
44
|
+
setv(to_object, ['flip_enabled'], getv(from_object, ['flipEnabled']))
|
45
|
+
|
46
|
+
if getv(from_object, ['autoraterModel']) is not None:
|
47
|
+
setv(to_object, ['autorater_model'], getv(from_object, ['autoraterModel']))
|
45
48
|
|
46
49
|
return to_object
|
47
50
|
|
48
51
|
|
49
|
-
def
|
52
|
+
def _AutoraterConfig_to_vertex(
|
50
53
|
from_object: Union[dict[str, Any], object],
|
51
54
|
parent_object: Optional[dict[str, Any]] = None,
|
52
55
|
) -> dict[str, Any]:
|
53
56
|
to_object: dict[str, Any] = {}
|
57
|
+
if getv(from_object, ['sampling_count']) is not None:
|
58
|
+
setv(to_object, ['samplingCount'], getv(from_object, ['sampling_count']))
|
54
59
|
|
55
|
-
if getv(from_object, ['
|
56
|
-
setv(
|
57
|
-
parent_object, ['_query', 'pageSize'], getv(from_object, ['page_size'])
|
58
|
-
)
|
59
|
-
|
60
|
-
if getv(from_object, ['page_token']) is not None:
|
61
|
-
setv(
|
62
|
-
parent_object,
|
63
|
-
['_query', 'pageToken'],
|
64
|
-
getv(from_object, ['page_token']),
|
65
|
-
)
|
66
|
-
|
67
|
-
if getv(from_object, ['filter']) is not None:
|
68
|
-
setv(parent_object, ['_query', 'filter'], getv(from_object, ['filter']))
|
69
|
-
|
70
|
-
return to_object
|
71
|
-
|
60
|
+
if getv(from_object, ['flip_enabled']) is not None:
|
61
|
+
setv(to_object, ['flipEnabled'], getv(from_object, ['flip_enabled']))
|
72
62
|
|
73
|
-
|
74
|
-
|
75
|
-
parent_object: Optional[dict[str, Any]] = None,
|
76
|
-
) -> dict[str, Any]:
|
77
|
-
to_object: dict[str, Any] = {}
|
78
|
-
if getv(from_object, ['config']) is not None:
|
79
|
-
setv(
|
80
|
-
to_object,
|
81
|
-
['config'],
|
82
|
-
_ListTuningJobsConfig_to_mldev(
|
83
|
-
getv(from_object, ['config']), to_object
|
84
|
-
),
|
85
|
-
)
|
63
|
+
if getv(from_object, ['autorater_model']) is not None:
|
64
|
+
setv(to_object, ['autoraterModel'], getv(from_object, ['autorater_model']))
|
86
65
|
|
87
66
|
return to_object
|
88
67
|
|
@@ -95,48 +74,16 @@ def _CancelTuningJobParameters_to_mldev(
|
|
95
74
|
if getv(from_object, ['name']) is not None:
|
96
75
|
setv(to_object, ['_url', 'name'], getv(from_object, ['name']))
|
97
76
|
|
98
|
-
if getv(from_object, ['config']) is not None:
|
99
|
-
setv(to_object, ['config'], getv(from_object, ['config']))
|
100
|
-
|
101
77
|
return to_object
|
102
78
|
|
103
79
|
|
104
|
-
def
|
105
|
-
from_object: Union[dict[str, Any], object],
|
106
|
-
parent_object: Optional[dict[str, Any]] = None,
|
107
|
-
) -> dict[str, Any]:
|
108
|
-
to_object: dict[str, Any] = {}
|
109
|
-
if getv(from_object, ['text_input']) is not None:
|
110
|
-
setv(to_object, ['textInput'], getv(from_object, ['text_input']))
|
111
|
-
|
112
|
-
if getv(from_object, ['output']) is not None:
|
113
|
-
setv(to_object, ['output'], getv(from_object, ['output']))
|
114
|
-
|
115
|
-
return to_object
|
116
|
-
|
117
|
-
|
118
|
-
def _TuningDataset_to_mldev(
|
80
|
+
def _CancelTuningJobParameters_to_vertex(
|
119
81
|
from_object: Union[dict[str, Any], object],
|
120
82
|
parent_object: Optional[dict[str, Any]] = None,
|
121
83
|
) -> dict[str, Any]:
|
122
84
|
to_object: dict[str, Any] = {}
|
123
|
-
if getv(from_object, ['
|
124
|
-
|
125
|
-
|
126
|
-
if getv(from_object, ['vertex_dataset_resource']) is not None:
|
127
|
-
raise ValueError(
|
128
|
-
'vertex_dataset_resource parameter is not supported in Gemini API.'
|
129
|
-
)
|
130
|
-
|
131
|
-
if getv(from_object, ['examples']) is not None:
|
132
|
-
setv(
|
133
|
-
to_object,
|
134
|
-
['examples', 'examples'],
|
135
|
-
[
|
136
|
-
_TuningExample_to_mldev(item, to_object)
|
137
|
-
for item in getv(from_object, ['examples'])
|
138
|
-
],
|
139
|
-
)
|
85
|
+
if getv(from_object, ['name']) is not None:
|
86
|
+
setv(to_object, ['_url', 'name'], getv(from_object, ['name']))
|
140
87
|
|
141
88
|
return to_object
|
142
89
|
|
@@ -215,197 +162,161 @@ def _CreateTuningJobConfig_to_mldev(
|
|
215
162
|
return to_object
|
216
163
|
|
217
164
|
|
218
|
-
def
|
165
|
+
def _CreateTuningJobConfig_to_vertex(
|
219
166
|
from_object: Union[dict[str, Any], object],
|
220
167
|
parent_object: Optional[dict[str, Any]] = None,
|
221
168
|
) -> dict[str, Any]:
|
222
169
|
to_object: dict[str, Any] = {}
|
223
|
-
if getv(from_object, ['base_model']) is not None:
|
224
|
-
setv(to_object, ['baseModel'], getv(from_object, ['base_model']))
|
225
|
-
|
226
|
-
if getv(from_object, ['pre_tuned_model']) is not None:
|
227
|
-
setv(to_object, ['preTunedModel'], getv(from_object, ['pre_tuned_model']))
|
228
170
|
|
229
|
-
if getv(from_object, ['
|
171
|
+
if getv(from_object, ['validation_dataset']) is not None:
|
230
172
|
setv(
|
231
|
-
|
232
|
-
['
|
233
|
-
|
234
|
-
getv(from_object, ['
|
173
|
+
parent_object,
|
174
|
+
['supervisedTuningSpec'],
|
175
|
+
_TuningValidationDataset_to_vertex(
|
176
|
+
getv(from_object, ['validation_dataset']), to_object
|
235
177
|
),
|
236
178
|
)
|
237
179
|
|
238
|
-
if getv(from_object, ['
|
180
|
+
if getv(from_object, ['tuned_model_display_name']) is not None:
|
239
181
|
setv(
|
240
|
-
|
241
|
-
['
|
242
|
-
|
243
|
-
getv(from_object, ['config']), to_object
|
244
|
-
),
|
182
|
+
parent_object,
|
183
|
+
['tunedModelDisplayName'],
|
184
|
+
getv(from_object, ['tuned_model_display_name']),
|
245
185
|
)
|
246
186
|
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
def _GetTuningJobParameters_to_vertex(
|
251
|
-
from_object: Union[dict[str, Any], object],
|
252
|
-
parent_object: Optional[dict[str, Any]] = None,
|
253
|
-
) -> dict[str, Any]:
|
254
|
-
to_object: dict[str, Any] = {}
|
255
|
-
if getv(from_object, ['name']) is not None:
|
256
|
-
setv(to_object, ['_url', 'name'], getv(from_object, ['name']))
|
257
|
-
|
258
|
-
if getv(from_object, ['config']) is not None:
|
259
|
-
setv(to_object, ['config'], getv(from_object, ['config']))
|
260
|
-
|
261
|
-
return to_object
|
262
|
-
|
187
|
+
if getv(from_object, ['description']) is not None:
|
188
|
+
setv(parent_object, ['description'], getv(from_object, ['description']))
|
263
189
|
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
190
|
+
if getv(from_object, ['epoch_count']) is not None:
|
191
|
+
setv(
|
192
|
+
parent_object,
|
193
|
+
['supervisedTuningSpec', 'hyperParameters', 'epochCount'],
|
194
|
+
getv(from_object, ['epoch_count']),
|
195
|
+
)
|
269
196
|
|
270
|
-
if getv(from_object, ['
|
197
|
+
if getv(from_object, ['learning_rate_multiplier']) is not None:
|
271
198
|
setv(
|
272
|
-
parent_object,
|
199
|
+
parent_object,
|
200
|
+
['supervisedTuningSpec', 'hyperParameters', 'learningRateMultiplier'],
|
201
|
+
getv(from_object, ['learning_rate_multiplier']),
|
273
202
|
)
|
274
203
|
|
275
|
-
if getv(from_object, ['
|
204
|
+
if getv(from_object, ['export_last_checkpoint_only']) is not None:
|
276
205
|
setv(
|
277
206
|
parent_object,
|
278
|
-
['
|
279
|
-
getv(from_object, ['
|
207
|
+
['supervisedTuningSpec', 'exportLastCheckpointOnly'],
|
208
|
+
getv(from_object, ['export_last_checkpoint_only']),
|
280
209
|
)
|
281
210
|
|
282
|
-
if getv(from_object, ['
|
283
|
-
setv(
|
211
|
+
if getv(from_object, ['adapter_size']) is not None:
|
212
|
+
setv(
|
213
|
+
parent_object,
|
214
|
+
['supervisedTuningSpec', 'hyperParameters', 'adapterSize'],
|
215
|
+
getv(from_object, ['adapter_size']),
|
216
|
+
)
|
284
217
|
|
285
|
-
|
218
|
+
if getv(from_object, ['batch_size']) is not None:
|
219
|
+
raise ValueError('batch_size parameter is not supported in Vertex AI.')
|
286
220
|
|
221
|
+
if getv(from_object, ['learning_rate']) is not None:
|
222
|
+
raise ValueError('learning_rate parameter is not supported in Vertex AI.')
|
287
223
|
|
288
|
-
|
289
|
-
from_object: Union[dict[str, Any], object],
|
290
|
-
parent_object: Optional[dict[str, Any]] = None,
|
291
|
-
) -> dict[str, Any]:
|
292
|
-
to_object: dict[str, Any] = {}
|
293
|
-
if getv(from_object, ['config']) is not None:
|
224
|
+
if getv(from_object, ['evaluation_config']) is not None:
|
294
225
|
setv(
|
295
|
-
|
296
|
-
['
|
297
|
-
|
298
|
-
getv(from_object, ['
|
226
|
+
parent_object,
|
227
|
+
['supervisedTuningSpec', 'evaluationConfig'],
|
228
|
+
_EvaluationConfig_to_vertex(
|
229
|
+
getv(from_object, ['evaluation_config']), to_object
|
299
230
|
),
|
300
231
|
)
|
301
232
|
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
def _CancelTuningJobParameters_to_vertex(
|
306
|
-
from_object: Union[dict[str, Any], object],
|
307
|
-
parent_object: Optional[dict[str, Any]] = None,
|
308
|
-
) -> dict[str, Any]:
|
309
|
-
to_object: dict[str, Any] = {}
|
310
|
-
if getv(from_object, ['name']) is not None:
|
311
|
-
setv(to_object, ['_url', 'name'], getv(from_object, ['name']))
|
312
|
-
|
313
|
-
if getv(from_object, ['config']) is not None:
|
314
|
-
setv(to_object, ['config'], getv(from_object, ['config']))
|
233
|
+
if getv(from_object, ['labels']) is not None:
|
234
|
+
setv(parent_object, ['labels'], getv(from_object, ['labels']))
|
315
235
|
|
316
236
|
return to_object
|
317
237
|
|
318
238
|
|
319
|
-
def
|
239
|
+
def _CreateTuningJobParametersPrivate_to_mldev(
|
320
240
|
from_object: Union[dict[str, Any], object],
|
321
241
|
parent_object: Optional[dict[str, Any]] = None,
|
322
242
|
) -> dict[str, Any]:
|
323
243
|
to_object: dict[str, Any] = {}
|
324
|
-
if getv(from_object, ['
|
325
|
-
setv(
|
326
|
-
parent_object,
|
327
|
-
['supervisedTuningSpec', 'trainingDatasetUri'],
|
328
|
-
getv(from_object, ['gcs_uri']),
|
329
|
-
)
|
244
|
+
if getv(from_object, ['base_model']) is not None:
|
245
|
+
setv(to_object, ['baseModel'], getv(from_object, ['base_model']))
|
330
246
|
|
331
|
-
if getv(from_object, ['
|
247
|
+
if getv(from_object, ['pre_tuned_model']) is not None:
|
248
|
+
setv(to_object, ['preTunedModel'], getv(from_object, ['pre_tuned_model']))
|
249
|
+
|
250
|
+
if getv(from_object, ['training_dataset']) is not None:
|
332
251
|
setv(
|
333
|
-
|
334
|
-
['
|
335
|
-
|
252
|
+
to_object,
|
253
|
+
['tuningTask', 'trainingData'],
|
254
|
+
_TuningDataset_to_mldev(
|
255
|
+
getv(from_object, ['training_dataset']), to_object
|
256
|
+
),
|
336
257
|
)
|
337
258
|
|
338
|
-
if getv(from_object, ['
|
339
|
-
|
259
|
+
if getv(from_object, ['config']) is not None:
|
260
|
+
_CreateTuningJobConfig_to_mldev(getv(from_object, ['config']), to_object)
|
340
261
|
|
341
262
|
return to_object
|
342
263
|
|
343
264
|
|
344
|
-
def
|
265
|
+
def _CreateTuningJobParametersPrivate_to_vertex(
|
345
266
|
from_object: Union[dict[str, Any], object],
|
346
267
|
parent_object: Optional[dict[str, Any]] = None,
|
347
268
|
) -> dict[str, Any]:
|
348
269
|
to_object: dict[str, Any] = {}
|
349
|
-
if getv(from_object, ['
|
350
|
-
setv(to_object, ['
|
270
|
+
if getv(from_object, ['base_model']) is not None:
|
271
|
+
setv(to_object, ['baseModel'], getv(from_object, ['base_model']))
|
351
272
|
|
352
|
-
if getv(from_object, ['
|
273
|
+
if getv(from_object, ['pre_tuned_model']) is not None:
|
274
|
+
setv(to_object, ['preTunedModel'], getv(from_object, ['pre_tuned_model']))
|
275
|
+
|
276
|
+
if getv(from_object, ['training_dataset']) is not None:
|
353
277
|
setv(
|
354
|
-
|
278
|
+
to_object,
|
355
279
|
['supervisedTuningSpec', 'trainingDatasetUri'],
|
356
|
-
|
280
|
+
_TuningDataset_to_vertex(
|
281
|
+
getv(from_object, ['training_dataset']), to_object
|
282
|
+
),
|
357
283
|
)
|
358
284
|
|
285
|
+
if getv(from_object, ['config']) is not None:
|
286
|
+
_CreateTuningJobConfig_to_vertex(getv(from_object, ['config']), to_object)
|
287
|
+
|
359
288
|
return to_object
|
360
289
|
|
361
290
|
|
362
|
-
def
|
291
|
+
def _EvaluationConfig_from_vertex(
|
363
292
|
from_object: Union[dict[str, Any], object],
|
364
293
|
parent_object: Optional[dict[str, Any]] = None,
|
365
294
|
) -> dict[str, Any]:
|
366
295
|
to_object: dict[str, Any] = {}
|
367
|
-
if getv(from_object, ['
|
296
|
+
if getv(from_object, ['metrics']) is not None:
|
297
|
+
setv(to_object, ['metrics'], t.t_metrics(getv(from_object, ['metrics'])))
|
298
|
+
|
299
|
+
if getv(from_object, ['outputConfig']) is not None:
|
368
300
|
setv(
|
369
|
-
to_object,
|
301
|
+
to_object,
|
302
|
+
['output_config'],
|
303
|
+
_OutputConfig_from_vertex(
|
304
|
+
getv(from_object, ['outputConfig']), to_object
|
305
|
+
),
|
370
306
|
)
|
371
307
|
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
def _OutputConfig_to_vertex(
|
376
|
-
from_object: Union[dict[str, Any], object],
|
377
|
-
parent_object: Optional[dict[str, Any]] = None,
|
378
|
-
) -> dict[str, Any]:
|
379
|
-
to_object: dict[str, Any] = {}
|
380
|
-
if getv(from_object, ['gcs_destination']) is not None:
|
308
|
+
if getv(from_object, ['autoraterConfig']) is not None:
|
381
309
|
setv(
|
382
310
|
to_object,
|
383
|
-
['
|
384
|
-
|
385
|
-
getv(from_object, ['
|
311
|
+
['autorater_config'],
|
312
|
+
_AutoraterConfig_from_vertex(
|
313
|
+
getv(from_object, ['autoraterConfig']), to_object
|
386
314
|
),
|
387
315
|
)
|
388
316
|
|
389
317
|
return to_object
|
390
318
|
|
391
319
|
|
392
|
-
def _AutoraterConfig_to_vertex(
|
393
|
-
from_object: Union[dict[str, Any], object],
|
394
|
-
parent_object: Optional[dict[str, Any]] = None,
|
395
|
-
) -> dict[str, Any]:
|
396
|
-
to_object: dict[str, Any] = {}
|
397
|
-
if getv(from_object, ['sampling_count']) is not None:
|
398
|
-
setv(to_object, ['samplingCount'], getv(from_object, ['sampling_count']))
|
399
|
-
|
400
|
-
if getv(from_object, ['flip_enabled']) is not None:
|
401
|
-
setv(to_object, ['flipEnabled'], getv(from_object, ['flip_enabled']))
|
402
|
-
|
403
|
-
if getv(from_object, ['autorater_model']) is not None:
|
404
|
-
setv(to_object, ['autoraterModel'], getv(from_object, ['autorater_model']))
|
405
|
-
|
406
|
-
return to_object
|
407
|
-
|
408
|
-
|
409
320
|
def _EvaluationConfig_to_vertex(
|
410
321
|
from_object: Union[dict[str, Any], object],
|
411
322
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -435,212 +346,120 @@ def _EvaluationConfig_to_vertex(
|
|
435
346
|
return to_object
|
436
347
|
|
437
348
|
|
438
|
-
def
|
349
|
+
def _GcsDestination_from_vertex(
|
439
350
|
from_object: Union[dict[str, Any], object],
|
440
351
|
parent_object: Optional[dict[str, Any]] = None,
|
441
352
|
) -> dict[str, Any]:
|
442
353
|
to_object: dict[str, Any] = {}
|
443
|
-
|
444
|
-
if getv(from_object, ['validation_dataset']) is not None:
|
445
|
-
setv(
|
446
|
-
parent_object,
|
447
|
-
['supervisedTuningSpec'],
|
448
|
-
_TuningValidationDataset_to_vertex(
|
449
|
-
getv(from_object, ['validation_dataset']), to_object
|
450
|
-
),
|
451
|
-
)
|
452
|
-
|
453
|
-
if getv(from_object, ['tuned_model_display_name']) is not None:
|
454
|
-
setv(
|
455
|
-
parent_object,
|
456
|
-
['tunedModelDisplayName'],
|
457
|
-
getv(from_object, ['tuned_model_display_name']),
|
458
|
-
)
|
459
|
-
|
460
|
-
if getv(from_object, ['description']) is not None:
|
461
|
-
setv(parent_object, ['description'], getv(from_object, ['description']))
|
462
|
-
|
463
|
-
if getv(from_object, ['epoch_count']) is not None:
|
464
|
-
setv(
|
465
|
-
parent_object,
|
466
|
-
['supervisedTuningSpec', 'hyperParameters', 'epochCount'],
|
467
|
-
getv(from_object, ['epoch_count']),
|
468
|
-
)
|
469
|
-
|
470
|
-
if getv(from_object, ['learning_rate_multiplier']) is not None:
|
471
|
-
setv(
|
472
|
-
parent_object,
|
473
|
-
['supervisedTuningSpec', 'hyperParameters', 'learningRateMultiplier'],
|
474
|
-
getv(from_object, ['learning_rate_multiplier']),
|
475
|
-
)
|
476
|
-
|
477
|
-
if getv(from_object, ['export_last_checkpoint_only']) is not None:
|
478
|
-
setv(
|
479
|
-
parent_object,
|
480
|
-
['supervisedTuningSpec', 'exportLastCheckpointOnly'],
|
481
|
-
getv(from_object, ['export_last_checkpoint_only']),
|
482
|
-
)
|
483
|
-
|
484
|
-
if getv(from_object, ['pre_tuned_model_checkpoint_id']) is not None:
|
485
|
-
setv(
|
486
|
-
to_object,
|
487
|
-
['preTunedModel', 'checkpointId'],
|
488
|
-
getv(from_object, ['pre_tuned_model_checkpoint_id']),
|
489
|
-
)
|
490
|
-
|
491
|
-
if getv(from_object, ['adapter_size']) is not None:
|
354
|
+
if getv(from_object, ['outputUriPrefix']) is not None:
|
492
355
|
setv(
|
493
|
-
|
494
|
-
['supervisedTuningSpec', 'hyperParameters', 'adapterSize'],
|
495
|
-
getv(from_object, ['adapter_size']),
|
356
|
+
to_object, ['output_uri_prefix'], getv(from_object, ['outputUriPrefix'])
|
496
357
|
)
|
497
358
|
|
498
|
-
|
499
|
-
raise ValueError('batch_size parameter is not supported in Vertex AI.')
|
359
|
+
return to_object
|
500
360
|
|
501
|
-
if getv(from_object, ['learning_rate']) is not None:
|
502
|
-
raise ValueError('learning_rate parameter is not supported in Vertex AI.')
|
503
361
|
|
504
|
-
|
362
|
+
def _GcsDestination_to_vertex(
|
363
|
+
from_object: Union[dict[str, Any], object],
|
364
|
+
parent_object: Optional[dict[str, Any]] = None,
|
365
|
+
) -> dict[str, Any]:
|
366
|
+
to_object: dict[str, Any] = {}
|
367
|
+
if getv(from_object, ['output_uri_prefix']) is not None:
|
505
368
|
setv(
|
506
|
-
|
507
|
-
['supervisedTuningSpec', 'evaluationConfig'],
|
508
|
-
_EvaluationConfig_to_vertex(
|
509
|
-
getv(from_object, ['evaluation_config']), to_object
|
510
|
-
),
|
369
|
+
to_object, ['outputUriPrefix'], getv(from_object, ['output_uri_prefix'])
|
511
370
|
)
|
512
371
|
|
513
|
-
if getv(from_object, ['labels']) is not None:
|
514
|
-
setv(parent_object, ['labels'], getv(from_object, ['labels']))
|
515
|
-
|
516
372
|
return to_object
|
517
373
|
|
518
374
|
|
519
|
-
def
|
375
|
+
def _GetTuningJobParameters_to_mldev(
|
520
376
|
from_object: Union[dict[str, Any], object],
|
521
377
|
parent_object: Optional[dict[str, Any]] = None,
|
522
378
|
) -> dict[str, Any]:
|
523
379
|
to_object: dict[str, Any] = {}
|
524
|
-
if getv(from_object, ['
|
525
|
-
setv(to_object, ['
|
526
|
-
|
527
|
-
if getv(from_object, ['pre_tuned_model']) is not None:
|
528
|
-
setv(to_object, ['preTunedModel'], getv(from_object, ['pre_tuned_model']))
|
529
|
-
|
530
|
-
if getv(from_object, ['training_dataset']) is not None:
|
531
|
-
setv(
|
532
|
-
to_object,
|
533
|
-
['supervisedTuningSpec', 'trainingDatasetUri'],
|
534
|
-
_TuningDataset_to_vertex(
|
535
|
-
getv(from_object, ['training_dataset']), to_object
|
536
|
-
),
|
537
|
-
)
|
538
|
-
|
539
|
-
if getv(from_object, ['config']) is not None:
|
540
|
-
setv(
|
541
|
-
to_object,
|
542
|
-
['config'],
|
543
|
-
_CreateTuningJobConfig_to_vertex(
|
544
|
-
getv(from_object, ['config']), to_object
|
545
|
-
),
|
546
|
-
)
|
380
|
+
if getv(from_object, ['name']) is not None:
|
381
|
+
setv(to_object, ['_url', 'name'], getv(from_object, ['name']))
|
547
382
|
|
548
383
|
return to_object
|
549
384
|
|
550
385
|
|
551
|
-
def
|
386
|
+
def _GetTuningJobParameters_to_vertex(
|
552
387
|
from_object: Union[dict[str, Any], object],
|
553
388
|
parent_object: Optional[dict[str, Any]] = None,
|
554
389
|
) -> dict[str, Any]:
|
555
390
|
to_object: dict[str, Any] = {}
|
556
391
|
if getv(from_object, ['name']) is not None:
|
557
|
-
setv(to_object, ['
|
558
|
-
|
559
|
-
if getv(from_object, ['name']) is not None:
|
560
|
-
setv(to_object, ['endpoint'], getv(from_object, ['name']))
|
392
|
+
setv(to_object, ['_url', 'name'], getv(from_object, ['name']))
|
561
393
|
|
562
394
|
return to_object
|
563
395
|
|
564
396
|
|
565
|
-
def
|
397
|
+
def _ListTuningJobsConfig_to_mldev(
|
566
398
|
from_object: Union[dict[str, Any], object],
|
567
399
|
parent_object: Optional[dict[str, Any]] = None,
|
568
400
|
) -> dict[str, Any]:
|
569
401
|
to_object: dict[str, Any] = {}
|
570
|
-
if getv(from_object, ['sdkHttpResponse']) is not None:
|
571
|
-
setv(
|
572
|
-
to_object, ['sdk_http_response'], getv(from_object, ['sdkHttpResponse'])
|
573
|
-
)
|
574
402
|
|
575
|
-
if getv(from_object, ['
|
576
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
577
|
-
|
578
|
-
if getv(from_object, ['state']) is not None:
|
403
|
+
if getv(from_object, ['page_size']) is not None:
|
579
404
|
setv(
|
580
|
-
|
581
|
-
['state'],
|
582
|
-
t.t_tuning_job_status(getv(from_object, ['state'])),
|
405
|
+
parent_object, ['_query', 'pageSize'], getv(from_object, ['page_size'])
|
583
406
|
)
|
584
407
|
|
585
|
-
if getv(from_object, ['
|
586
|
-
setv(to_object, ['create_time'], getv(from_object, ['createTime']))
|
587
|
-
|
588
|
-
if getv(from_object, ['tuningTask', 'startTime']) is not None:
|
408
|
+
if getv(from_object, ['page_token']) is not None:
|
589
409
|
setv(
|
590
|
-
|
591
|
-
['
|
592
|
-
getv(from_object, ['
|
410
|
+
parent_object,
|
411
|
+
['_query', 'pageToken'],
|
412
|
+
getv(from_object, ['page_token']),
|
593
413
|
)
|
594
414
|
|
595
|
-
if getv(from_object, ['
|
596
|
-
setv(
|
597
|
-
to_object,
|
598
|
-
['end_time'],
|
599
|
-
getv(from_object, ['tuningTask', 'completeTime']),
|
600
|
-
)
|
415
|
+
if getv(from_object, ['filter']) is not None:
|
416
|
+
setv(parent_object, ['_query', 'filter'], getv(from_object, ['filter']))
|
601
417
|
|
602
|
-
|
603
|
-
setv(to_object, ['update_time'], getv(from_object, ['updateTime']))
|
418
|
+
return to_object
|
604
419
|
|
605
|
-
if getv(from_object, ['description']) is not None:
|
606
|
-
setv(to_object, ['description'], getv(from_object, ['description']))
|
607
420
|
|
608
|
-
|
609
|
-
|
421
|
+
def _ListTuningJobsConfig_to_vertex(
|
422
|
+
from_object: Union[dict[str, Any], object],
|
423
|
+
parent_object: Optional[dict[str, Any]] = None,
|
424
|
+
) -> dict[str, Any]:
|
425
|
+
to_object: dict[str, Any] = {}
|
610
426
|
|
611
|
-
if getv(from_object, ['
|
427
|
+
if getv(from_object, ['page_size']) is not None:
|
612
428
|
setv(
|
613
|
-
|
614
|
-
['tuned_model'],
|
615
|
-
_TunedModel_from_mldev(getv(from_object, ['_self']), to_object),
|
429
|
+
parent_object, ['_query', 'pageSize'], getv(from_object, ['page_size'])
|
616
430
|
)
|
617
431
|
|
618
|
-
if getv(from_object, ['
|
432
|
+
if getv(from_object, ['page_token']) is not None:
|
619
433
|
setv(
|
620
|
-
|
434
|
+
parent_object,
|
435
|
+
['_query', 'pageToken'],
|
436
|
+
getv(from_object, ['page_token']),
|
621
437
|
)
|
622
438
|
|
623
|
-
if getv(from_object, ['
|
624
|
-
setv(
|
439
|
+
if getv(from_object, ['filter']) is not None:
|
440
|
+
setv(parent_object, ['_query', 'filter'], getv(from_object, ['filter']))
|
625
441
|
|
626
|
-
|
627
|
-
setv(to_object, ['labels'], getv(from_object, ['labels']))
|
442
|
+
return to_object
|
628
443
|
|
629
|
-
if getv(from_object, ['outputUri']) is not None:
|
630
|
-
setv(to_object, ['output_uri'], getv(from_object, ['outputUri']))
|
631
444
|
|
632
|
-
|
633
|
-
|
445
|
+
def _ListTuningJobsParameters_to_mldev(
|
446
|
+
from_object: Union[dict[str, Any], object],
|
447
|
+
parent_object: Optional[dict[str, Any]] = None,
|
448
|
+
) -> dict[str, Any]:
|
449
|
+
to_object: dict[str, Any] = {}
|
450
|
+
if getv(from_object, ['config']) is not None:
|
451
|
+
_ListTuningJobsConfig_to_mldev(getv(from_object, ['config']), to_object)
|
634
452
|
|
635
|
-
|
636
|
-
setv(to_object, ['service_account'], getv(from_object, ['serviceAccount']))
|
453
|
+
return to_object
|
637
454
|
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
455
|
+
|
456
|
+
def _ListTuningJobsParameters_to_vertex(
|
457
|
+
from_object: Union[dict[str, Any], object],
|
458
|
+
parent_object: Optional[dict[str, Any]] = None,
|
459
|
+
) -> dict[str, Any]:
|
460
|
+
to_object: dict[str, Any] = {}
|
461
|
+
if getv(from_object, ['config']) is not None:
|
462
|
+
_ListTuningJobsConfig_to_vertex(getv(from_object, ['config']), to_object)
|
644
463
|
|
645
464
|
return to_object
|
646
465
|
|
@@ -671,7 +490,7 @@ def _ListTuningJobsResponse_from_mldev(
|
|
671
490
|
return to_object
|
672
491
|
|
673
492
|
|
674
|
-
def
|
493
|
+
def _ListTuningJobsResponse_from_vertex(
|
675
494
|
from_object: Union[dict[str, Any], object],
|
676
495
|
parent_object: Optional[dict[str, Any]] = None,
|
677
496
|
) -> dict[str, Any]:
|
@@ -681,17 +500,52 @@ def _TuningOperation_from_mldev(
|
|
681
500
|
to_object, ['sdk_http_response'], getv(from_object, ['sdkHttpResponse'])
|
682
501
|
)
|
683
502
|
|
684
|
-
if getv(from_object, ['
|
685
|
-
setv(to_object, ['
|
503
|
+
if getv(from_object, ['nextPageToken']) is not None:
|
504
|
+
setv(to_object, ['next_page_token'], getv(from_object, ['nextPageToken']))
|
686
505
|
|
687
|
-
if getv(from_object, ['
|
688
|
-
setv(
|
506
|
+
if getv(from_object, ['tuningJobs']) is not None:
|
507
|
+
setv(
|
508
|
+
to_object,
|
509
|
+
['tuning_jobs'],
|
510
|
+
[
|
511
|
+
_TuningJob_from_vertex(item, to_object)
|
512
|
+
for item in getv(from_object, ['tuningJobs'])
|
513
|
+
],
|
514
|
+
)
|
689
515
|
|
690
|
-
|
691
|
-
setv(to_object, ['done'], getv(from_object, ['done']))
|
516
|
+
return to_object
|
692
517
|
|
693
|
-
|
694
|
-
|
518
|
+
|
519
|
+
def _OutputConfig_from_vertex(
|
520
|
+
from_object: Union[dict[str, Any], object],
|
521
|
+
parent_object: Optional[dict[str, Any]] = None,
|
522
|
+
) -> dict[str, Any]:
|
523
|
+
to_object: dict[str, Any] = {}
|
524
|
+
if getv(from_object, ['gcsDestination']) is not None:
|
525
|
+
setv(
|
526
|
+
to_object,
|
527
|
+
['gcs_destination'],
|
528
|
+
_GcsDestination_from_vertex(
|
529
|
+
getv(from_object, ['gcsDestination']), to_object
|
530
|
+
),
|
531
|
+
)
|
532
|
+
|
533
|
+
return to_object
|
534
|
+
|
535
|
+
|
536
|
+
def _OutputConfig_to_vertex(
|
537
|
+
from_object: Union[dict[str, Any], object],
|
538
|
+
parent_object: Optional[dict[str, Any]] = None,
|
539
|
+
) -> dict[str, Any]:
|
540
|
+
to_object: dict[str, Any] = {}
|
541
|
+
if getv(from_object, ['gcs_destination']) is not None:
|
542
|
+
setv(
|
543
|
+
to_object,
|
544
|
+
['gcsDestination'],
|
545
|
+
_GcsDestination_to_vertex(
|
546
|
+
getv(from_object, ['gcs_destination']), to_object
|
547
|
+
),
|
548
|
+
)
|
695
549
|
|
696
550
|
return to_object
|
697
551
|
|
@@ -716,6 +570,20 @@ def _TunedModelCheckpoint_from_vertex(
|
|
716
570
|
return to_object
|
717
571
|
|
718
572
|
|
573
|
+
def _TunedModel_from_mldev(
|
574
|
+
from_object: Union[dict[str, Any], object],
|
575
|
+
parent_object: Optional[dict[str, Any]] = None,
|
576
|
+
) -> dict[str, Any]:
|
577
|
+
to_object: dict[str, Any] = {}
|
578
|
+
if getv(from_object, ['name']) is not None:
|
579
|
+
setv(to_object, ['model'], getv(from_object, ['name']))
|
580
|
+
|
581
|
+
if getv(from_object, ['name']) is not None:
|
582
|
+
setv(to_object, ['endpoint'], getv(from_object, ['name']))
|
583
|
+
|
584
|
+
return to_object
|
585
|
+
|
586
|
+
|
719
587
|
def _TunedModel_from_vertex(
|
720
588
|
from_object: Union[dict[str, Any], object],
|
721
589
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -740,77 +608,149 @@ def _TunedModel_from_vertex(
|
|
740
608
|
return to_object
|
741
609
|
|
742
610
|
|
743
|
-
def
|
611
|
+
def _TuningDataset_to_mldev(
|
744
612
|
from_object: Union[dict[str, Any], object],
|
745
613
|
parent_object: Optional[dict[str, Any]] = None,
|
746
614
|
) -> dict[str, Any]:
|
747
615
|
to_object: dict[str, Any] = {}
|
748
|
-
if getv(from_object, ['
|
616
|
+
if getv(from_object, ['gcs_uri']) is not None:
|
617
|
+
raise ValueError('gcs_uri parameter is not supported in Gemini API.')
|
618
|
+
|
619
|
+
if getv(from_object, ['vertex_dataset_resource']) is not None:
|
620
|
+
raise ValueError(
|
621
|
+
'vertex_dataset_resource parameter is not supported in Gemini API.'
|
622
|
+
)
|
623
|
+
|
624
|
+
if getv(from_object, ['examples']) is not None:
|
749
625
|
setv(
|
750
|
-
to_object,
|
626
|
+
to_object,
|
627
|
+
['examples', 'examples'],
|
628
|
+
[
|
629
|
+
_TuningExample_to_mldev(item, to_object)
|
630
|
+
for item in getv(from_object, ['examples'])
|
631
|
+
],
|
751
632
|
)
|
752
633
|
|
753
634
|
return to_object
|
754
635
|
|
755
636
|
|
756
|
-
def
|
637
|
+
def _TuningDataset_to_vertex(
|
757
638
|
from_object: Union[dict[str, Any], object],
|
758
639
|
parent_object: Optional[dict[str, Any]] = None,
|
759
640
|
) -> dict[str, Any]:
|
760
641
|
to_object: dict[str, Any] = {}
|
761
|
-
if getv(from_object, ['
|
642
|
+
if getv(from_object, ['gcs_uri']) is not None:
|
762
643
|
setv(
|
763
|
-
|
764
|
-
['
|
765
|
-
|
766
|
-
|
767
|
-
|
644
|
+
parent_object,
|
645
|
+
['supervisedTuningSpec', 'trainingDatasetUri'],
|
646
|
+
getv(from_object, ['gcs_uri']),
|
647
|
+
)
|
648
|
+
|
649
|
+
if getv(from_object, ['vertex_dataset_resource']) is not None:
|
650
|
+
setv(
|
651
|
+
parent_object,
|
652
|
+
['supervisedTuningSpec', 'trainingDatasetUri'],
|
653
|
+
getv(from_object, ['vertex_dataset_resource']),
|
768
654
|
)
|
769
655
|
|
656
|
+
if getv(from_object, ['examples']) is not None:
|
657
|
+
raise ValueError('examples parameter is not supported in Vertex AI.')
|
658
|
+
|
770
659
|
return to_object
|
771
660
|
|
772
661
|
|
773
|
-
def
|
662
|
+
def _TuningExample_to_mldev(
|
774
663
|
from_object: Union[dict[str, Any], object],
|
775
664
|
parent_object: Optional[dict[str, Any]] = None,
|
776
665
|
) -> dict[str, Any]:
|
777
666
|
to_object: dict[str, Any] = {}
|
778
|
-
if getv(from_object, ['
|
779
|
-
setv(to_object, ['
|
780
|
-
|
781
|
-
if getv(from_object, ['flipEnabled']) is not None:
|
782
|
-
setv(to_object, ['flip_enabled'], getv(from_object, ['flipEnabled']))
|
667
|
+
if getv(from_object, ['text_input']) is not None:
|
668
|
+
setv(to_object, ['textInput'], getv(from_object, ['text_input']))
|
783
669
|
|
784
|
-
if getv(from_object, ['
|
785
|
-
setv(to_object, ['
|
670
|
+
if getv(from_object, ['output']) is not None:
|
671
|
+
setv(to_object, ['output'], getv(from_object, ['output']))
|
786
672
|
|
787
673
|
return to_object
|
788
674
|
|
789
675
|
|
790
|
-
def
|
676
|
+
def _TuningJob_from_mldev(
|
791
677
|
from_object: Union[dict[str, Any], object],
|
792
678
|
parent_object: Optional[dict[str, Any]] = None,
|
793
679
|
) -> dict[str, Any]:
|
794
680
|
to_object: dict[str, Any] = {}
|
795
|
-
if getv(from_object, ['
|
796
|
-
setv(
|
681
|
+
if getv(from_object, ['sdkHttpResponse']) is not None:
|
682
|
+
setv(
|
683
|
+
to_object, ['sdk_http_response'], getv(from_object, ['sdkHttpResponse'])
|
684
|
+
)
|
797
685
|
|
798
|
-
if getv(from_object, ['
|
686
|
+
if getv(from_object, ['name']) is not None:
|
687
|
+
setv(to_object, ['name'], getv(from_object, ['name']))
|
688
|
+
|
689
|
+
if getv(from_object, ['state']) is not None:
|
799
690
|
setv(
|
800
691
|
to_object,
|
801
|
-
['
|
802
|
-
|
803
|
-
getv(from_object, ['outputConfig']), to_object
|
804
|
-
),
|
692
|
+
['state'],
|
693
|
+
t.t_tuning_job_status(getv(from_object, ['state'])),
|
805
694
|
)
|
806
695
|
|
807
|
-
if getv(from_object, ['
|
696
|
+
if getv(from_object, ['createTime']) is not None:
|
697
|
+
setv(to_object, ['create_time'], getv(from_object, ['createTime']))
|
698
|
+
|
699
|
+
if getv(from_object, ['tuningTask', 'startTime']) is not None:
|
808
700
|
setv(
|
809
701
|
to_object,
|
810
|
-
['
|
811
|
-
|
812
|
-
|
813
|
-
|
702
|
+
['start_time'],
|
703
|
+
getv(from_object, ['tuningTask', 'startTime']),
|
704
|
+
)
|
705
|
+
|
706
|
+
if getv(from_object, ['tuningTask', 'completeTime']) is not None:
|
707
|
+
setv(
|
708
|
+
to_object,
|
709
|
+
['end_time'],
|
710
|
+
getv(from_object, ['tuningTask', 'completeTime']),
|
711
|
+
)
|
712
|
+
|
713
|
+
if getv(from_object, ['updateTime']) is not None:
|
714
|
+
setv(to_object, ['update_time'], getv(from_object, ['updateTime']))
|
715
|
+
|
716
|
+
if getv(from_object, ['description']) is not None:
|
717
|
+
setv(to_object, ['description'], getv(from_object, ['description']))
|
718
|
+
|
719
|
+
if getv(from_object, ['baseModel']) is not None:
|
720
|
+
setv(to_object, ['base_model'], getv(from_object, ['baseModel']))
|
721
|
+
|
722
|
+
if getv(from_object, ['_self']) is not None:
|
723
|
+
setv(
|
724
|
+
to_object,
|
725
|
+
['tuned_model'],
|
726
|
+
_TunedModel_from_mldev(getv(from_object, ['_self']), to_object),
|
727
|
+
)
|
728
|
+
|
729
|
+
if getv(from_object, ['customBaseModel']) is not None:
|
730
|
+
setv(
|
731
|
+
to_object, ['custom_base_model'], getv(from_object, ['customBaseModel'])
|
732
|
+
)
|
733
|
+
|
734
|
+
if getv(from_object, ['experiment']) is not None:
|
735
|
+
setv(to_object, ['experiment'], getv(from_object, ['experiment']))
|
736
|
+
|
737
|
+
if getv(from_object, ['labels']) is not None:
|
738
|
+
setv(to_object, ['labels'], getv(from_object, ['labels']))
|
739
|
+
|
740
|
+
if getv(from_object, ['outputUri']) is not None:
|
741
|
+
setv(to_object, ['output_uri'], getv(from_object, ['outputUri']))
|
742
|
+
|
743
|
+
if getv(from_object, ['pipelineJob']) is not None:
|
744
|
+
setv(to_object, ['pipeline_job'], getv(from_object, ['pipelineJob']))
|
745
|
+
|
746
|
+
if getv(from_object, ['serviceAccount']) is not None:
|
747
|
+
setv(to_object, ['service_account'], getv(from_object, ['serviceAccount']))
|
748
|
+
|
749
|
+
if getv(from_object, ['tunedModelDisplayName']) is not None:
|
750
|
+
setv(
|
751
|
+
to_object,
|
752
|
+
['tuned_model_display_name'],
|
753
|
+
getv(from_object, ['tunedModelDisplayName']),
|
814
754
|
)
|
815
755
|
|
816
756
|
return to_object
|
@@ -928,7 +868,7 @@ def _TuningJob_from_vertex(
|
|
928
868
|
return to_object
|
929
869
|
|
930
870
|
|
931
|
-
def
|
871
|
+
def _TuningOperation_from_mldev(
|
932
872
|
from_object: Union[dict[str, Any], object],
|
933
873
|
parent_object: Optional[dict[str, Any]] = None,
|
934
874
|
) -> dict[str, Any]:
|
@@ -938,17 +878,34 @@ def _ListTuningJobsResponse_from_vertex(
|
|
938
878
|
to_object, ['sdk_http_response'], getv(from_object, ['sdkHttpResponse'])
|
939
879
|
)
|
940
880
|
|
941
|
-
if getv(from_object, ['
|
942
|
-
setv(to_object, ['
|
881
|
+
if getv(from_object, ['name']) is not None:
|
882
|
+
setv(to_object, ['name'], getv(from_object, ['name']))
|
943
883
|
|
944
|
-
if getv(from_object, ['
|
884
|
+
if getv(from_object, ['metadata']) is not None:
|
885
|
+
setv(to_object, ['metadata'], getv(from_object, ['metadata']))
|
886
|
+
|
887
|
+
if getv(from_object, ['done']) is not None:
|
888
|
+
setv(to_object, ['done'], getv(from_object, ['done']))
|
889
|
+
|
890
|
+
if getv(from_object, ['error']) is not None:
|
891
|
+
setv(to_object, ['error'], getv(from_object, ['error']))
|
892
|
+
|
893
|
+
return to_object
|
894
|
+
|
895
|
+
|
896
|
+
def _TuningValidationDataset_to_vertex(
|
897
|
+
from_object: Union[dict[str, Any], object],
|
898
|
+
parent_object: Optional[dict[str, Any]] = None,
|
899
|
+
) -> dict[str, Any]:
|
900
|
+
to_object: dict[str, Any] = {}
|
901
|
+
if getv(from_object, ['gcs_uri']) is not None:
|
902
|
+
setv(to_object, ['validationDatasetUri'], getv(from_object, ['gcs_uri']))
|
903
|
+
|
904
|
+
if getv(from_object, ['vertex_dataset_resource']) is not None:
|
945
905
|
setv(
|
946
|
-
|
947
|
-
['
|
948
|
-
[
|
949
|
-
_TuningJob_from_vertex(item, to_object)
|
950
|
-
for item in getv(from_object, ['tuningJobs'])
|
951
|
-
],
|
906
|
+
parent_object,
|
907
|
+
['supervisedTuningSpec', 'trainingDatasetUri'],
|
908
|
+
getv(from_object, ['vertex_dataset_resource']),
|
952
909
|
)
|
953
910
|
|
954
911
|
return to_object
|
@@ -1334,7 +1291,12 @@ class Tunings(_api_module.BaseModule):
|
|
1334
1291
|
) -> types.TuningJob:
|
1335
1292
|
if self._api_client.vertexai:
|
1336
1293
|
if base_model.startswith('projects/'): # Pre-tuned model
|
1337
|
-
|
1294
|
+
checkpoint_id = None
|
1295
|
+
if config:
|
1296
|
+
checkpoint_id = getattr(config, 'pre_tuned_model_checkpoint_id', None)
|
1297
|
+
pre_tuned_model = types.PreTunedModel(
|
1298
|
+
tuned_model_name=base_model, checkpoint_id=checkpoint_id
|
1299
|
+
)
|
1338
1300
|
tuning_job = self._tune(
|
1339
1301
|
pre_tuned_model=pre_tuned_model,
|
1340
1302
|
training_dataset=training_dataset,
|
@@ -1784,7 +1746,12 @@ class AsyncTunings(_api_module.BaseModule):
|
|
1784
1746
|
) -> types.TuningJob:
|
1785
1747
|
if self._api_client.vertexai:
|
1786
1748
|
if base_model.startswith('projects/'): # Pre-tuned model
|
1787
|
-
|
1749
|
+
checkpoint_id = None
|
1750
|
+
if config:
|
1751
|
+
checkpoint_id = getattr(config, 'pre_tuned_model_checkpoint_id', None)
|
1752
|
+
pre_tuned_model = types.PreTunedModel(
|
1753
|
+
tuned_model_name=base_model, checkpoint_id=checkpoint_id
|
1754
|
+
)
|
1788
1755
|
|
1789
1756
|
tuning_job = await self._tune(
|
1790
1757
|
pre_tuned_model=pre_tuned_model,
|