Implementation:Googleapis Python genai CreateTuningJobConfig Setup
| Knowledge Sources | |
|---|---|
| Domains | Fine_Tuning, Hyperparameter_Tuning |
| Last Updated | 2026-02-15 00:00 GMT |
Overview
Concrete tool for specifying fine-tuning job hyperparameters and configuration provided by the google-genai types module.
Description
CreateTuningJobConfig is a Pydantic model that holds all optional configuration for a fine-tuning job. It specifies the tuning method (SUPERVISED_FINE_TUNING, DISTILLATION, PREFERENCE_TUNING), hyperparameters (epoch_count, learning_rate_multiplier), LoRA adapter size, tuned model display name, optional validation dataset, and description. It is passed as the config parameter to tunings.tune.
Usage
Create a CreateTuningJobConfig with the desired hyperparameters and pass it to tunings.tune. All fields are optional; the service applies sensible defaults. Set tuned_model_display_name for easy identification. Use method to switch between tuning approaches.
Code Reference
Source Location
- Repository: googleapis/python-genai
- File: google/genai/types.py
- Lines: L12173
Signature
class CreateTuningJobConfig(_common.BaseModel):
"""Fine-tuning job creation configuration."""
http_options: Optional[HttpOptions] = None
method: Optional[TuningMethod] = None
validation_dataset: Optional[TuningValidationDataset] = None
tuned_model_display_name: Optional[str] = None
description: Optional[str] = None
epoch_count: Optional[int] = None
learning_rate_multiplier: Optional[float] = None
adapter_size: Optional[AdapterSize] = None
Import
from google.genai import types
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| method | Optional[TuningMethod] | No | SUPERVISED_FINE_TUNING, DISTILLATION, or PREFERENCE_TUNING |
| epoch_count | Optional[int] | No | Number of training epochs |
| learning_rate_multiplier | Optional[float] | No | Learning rate multiplier |
| adapter_size | Optional[AdapterSize] | No | LoRA adapter size (rank) |
| tuned_model_display_name | Optional[str] | No | Display name for the tuned model |
| validation_dataset | Optional[TuningValidationDataset] | No | Validation dataset for evaluation |
| description | Optional[str] | No | Description of the tuning job |
Outputs
| Name | Type | Description |
|---|---|---|
| CreateTuningJobConfig | CreateTuningJobConfig | Configuration object to pass to tunings.tune |
Usage Examples
Basic Configuration
from google.genai import types
config = types.CreateTuningJobConfig(
epoch_count=5,
learning_rate_multiplier=1.0,
tuned_model_display_name="my-sentiment-classifier",
)
With LoRA Adapter Size
config = types.CreateTuningJobConfig(
epoch_count=3,
adapter_size="ADAPTER_SIZE_FOUR",
tuned_model_display_name="my-lora-model",
description="Sentiment classification fine-tune with LoRA rank 4",
)