Module sft (1.72.0)

Classes for supervised tuning.

Classes

SupervisedTuningJob

SupervisedTuningJob(tuning_job_name: str)

Initializes class with project, location, and api_client.

Parameters
Name Description
project str

Project of the resource noun.

location str

The location of the resource noun.

credentials google.auth.credentials.Credentials

Optional custom credentials to use when accessing interacting with resource noun.

resource_name str

A fully-qualified resource name or ID.

Modules Functions

rebase_tuned_model

rebase_tuned_model(
    tuned_model_ref: str,
    *,
    artifact_destination: typing.Optional[str] = None,
    deploy_to_same_endpoint: typing.Optional[bool] = False
)

Re-runs fine tuning on top of a new foundational model.

Takes a legacy Tuned GenAI model Reference and creates a TuningJob based on a new model.

train

train(
    *,
    source_model: typing.Union[str, vertexai.generative_models.GenerativeModel],
    train_dataset: str,
    validation_dataset: typing.Optional[str] = None,
    tuned_model_display_name: typing.Optional[str] = None,
    epochs: typing.Optional[int] = None,
    learning_rate_multiplier: typing.Optional[float] = None,
    adapter_size: typing.Optional[typing.Literal[1, 4, 8, 16]] = None,
    labels: typing.Optional[typing.Dict[str, str]] = None
) -> vertexai.tuning._supervised_tuning.SupervisedTuningJob

Tunes a model using supervised training.

Parameter
Name Description
source_model str

Model name for tuning, e.g., "gemini-1.0-pro-002".