Skip to main content

tuning_jobs

Creates, updates, deletes, gets or lists a tuning_jobs resource.

Overview

Nametuning_jobs
TypeResource
Idgoogle.aiplatform.tuning_jobs

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringOutput only. Identifier. Resource name of a TuningJob. Format: projects/{project}/locations/{location}/tuningJobs/{tuning_job}
baseModelstringThe base model that is being tuned. See Supported models.
createTimestring (google-datetime)Output only. Time when the TuningJob was created.
descriptionstringOptional. The description of the TuningJob.
encryptionSpecobjectCustomer-managed encryption key options for a TuningJob. If this is set, then all resources created by the TuningJob will be encrypted with the provided encryption key. (id: GoogleCloudAiplatformV1EncryptionSpec)
endTimestring (google-datetime)Output only. Time when the TuningJob entered any of the following JobStates: JOB_STATE_SUCCEEDED, JOB_STATE_FAILED, JOB_STATE_CANCELLED, JOB_STATE_EXPIRED.
errorobjectThe Status type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC. Each Status message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the API Design Guide. (id: GoogleRpcStatus)
experimentstringOutput only. The Experiment associated with this TuningJob.
labelsobjectOptional. The labels with user-defined metadata to organize TuningJob and generated resources such as Model and Endpoint. Label keys and values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. See https://goo.gl/xmQnxf for more information and examples of labels.
preTunedModelobjectThe pre-tuned model for continuous tuning. (id: GoogleCloudAiplatformV1PreTunedModel)
preferenceOptimizationSpecobjectTuning Spec for Preference Optimization. (id: GoogleCloudAiplatformV1PreferenceOptimizationSpec)
serviceAccountstringThe service account that the tuningJob workload runs as. If not specified, the Vertex AI Secure Fine-Tuned Service Agent in the project will be used. See https://cloud.google.com/iam/docs/service-agents#vertex-ai-secure-fine-tuning-service-agent Users starting the pipeline must have the iam.serviceAccounts.actAs permission on this service account.
startTimestring (google-datetime)Output only. Time when the TuningJob for the first time entered the JOB_STATE_RUNNING state.
statestringOutput only. The detailed state of the job.
supervisedTuningSpecobjectTuning Spec for Supervised Fine Tuning. (id: GoogleCloudAiplatformV1SupervisedTuningSpec)
tunedModelobjectOutput only. The tuned model resources associated with this TuningJob. (id: GoogleCloudAiplatformV1TunedModel)
tunedModelDisplayNamestringOptional. The display name of the TunedModel. The name can be up to 128 characters long and can consist of any UTF-8 characters. For continuous tuning, tuned_model_display_name will by default use the same display name as the pre-tuned model. If a new display name is provided, the tuning job will create a new model instead of a new version.
tuningDataStatsobjectOutput only. The tuning data statistics associated with this TuningJob. (id: GoogleCloudAiplatformV1TuningDataStats)
updateTimestring (google-datetime)Output only. Time when the TuningJob was most recently updated.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, locationsId, tuningJobsIdGets a TuningJob.
listselectprojectsId, locationsIdpageToken, filter, pageSizeLists TuningJobs in a Location.
createinsertprojectsId, locationsIdCreates a TuningJob. A created TuningJob right away will be attempted to be run.
cancelexecprojectsId, locationsId, tuningJobsIdCancels a TuningJob. Starts asynchronous cancellation on the TuningJob. The server makes a best effort to cancel the job, but success is not guaranteed. Clients can use GenAiTuningService.GetTuningJob or other methods to check whether the cancellation succeeded or whether the job completed despite cancellation. On successful cancellation, the TuningJob is not deleted; instead it becomes a job with a TuningJob.error value with a google.rpc.Status.code of 1, corresponding to Code.CANCELLED, and TuningJob.state is set to CANCELLED.
rebase_tuned_modelexecprojectsId, locationsIdRebase a TunedModel.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
locationsIdstring
projectsIdstring
tuningJobsIdstring
filterstring
pageSizeinteger (int32)
pageTokenstring

SELECT examples

Gets a TuningJob.

SELECT
name,
baseModel,
createTime,
description,
encryptionSpec,
endTime,
error,
experiment,
labels,
preTunedModel,
preferenceOptimizationSpec,
serviceAccount,
startTime,
state,
supervisedTuningSpec,
tunedModel,
tunedModelDisplayName,
tuningDataStats,
updateTime
FROM google.aiplatform.tuning_jobs
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND tuningJobsId = '{{ tuningJobsId }}' -- required
;

INSERT examples

Creates a TuningJob. A created TuningJob right away will be attempted to be run.

INSERT INTO google.aiplatform.tuning_jobs (
data__encryptionSpec,
data__supervisedTuningSpec,
data__tunedModelDisplayName,
data__preTunedModel,
data__labels,
data__description,
data__preferenceOptimizationSpec,
data__serviceAccount,
data__baseModel,
projectsId,
locationsId
)
SELECT
'{{ encryptionSpec }}',
'{{ supervisedTuningSpec }}',
'{{ tunedModelDisplayName }}',
'{{ preTunedModel }}',
'{{ labels }}',
'{{ description }}',
'{{ preferenceOptimizationSpec }}',
'{{ serviceAccount }}',
'{{ baseModel }}',
'{{ projectsId }}',
'{{ locationsId }}'
RETURNING
name,
baseModel,
createTime,
description,
encryptionSpec,
endTime,
error,
experiment,
labels,
preTunedModel,
preferenceOptimizationSpec,
serviceAccount,
startTime,
state,
supervisedTuningSpec,
tunedModel,
tunedModelDisplayName,
tuningDataStats,
updateTime
;

Lifecycle Methods

Cancels a TuningJob. Starts asynchronous cancellation on the TuningJob. The server makes a best effort to cancel the job, but success is not guaranteed. Clients can use GenAiTuningService.GetTuningJob or other methods to check whether the cancellation succeeded or whether the job completed despite cancellation. On successful cancellation, the TuningJob is not deleted; instead it becomes a job with a TuningJob.error value with a google.rpc.Status.code of 1, corresponding to Code.CANCELLED, and TuningJob.state is set to CANCELLED.

EXEC google.aiplatform.tuning_jobs.cancel 
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@tuningJobsId='{{ tuningJobsId }}' --required
;