Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Google.GenAI/Tunings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,11 @@ internal JsonNode CreateTuningJobConfigToVertex(JsonNode fromObject, JsonObject
Common.SetValueByPath(parentObject, new string[] { "supervisedTuningSpec", "tuningMode" },
Common.GetValueByPath(fromObject, new string[] { "tuningMode" }));
}
} else if (discriminatorValueTuningMode == "DISTILLATION") {
if (Common.GetValueByPath(fromObject, new string[] { "tuningMode" }) != null) {
Common.SetValueByPath(parentObject, new string[] { "distillationSpec", "tuningMode" },
Common.GetValueByPath(fromObject, new string[] { "tuningMode" }));
}
}
if (Common.GetValueByPath(fromObject, new string[] { "customBaseModel" }) != null) {
Common.SetValueByPath(
Expand All @@ -373,6 +378,12 @@ internal JsonNode CreateTuningJobConfigToVertex(JsonNode fromObject, JsonObject
parentObject, new string[] { "supervisedTuningSpec", "hyperParameters", "batchSize" },
Common.GetValueByPath(fromObject, new string[] { "batchSize" }));
}
} else if (discriminatorValueBatchSize == "DISTILLATION") {
if (Common.GetValueByPath(fromObject, new string[] { "batchSize" }) != null) {
Common.SetValueByPath(parentObject,
new string[] { "distillationSpec", "hyperParameters", "batchSize" },
Common.GetValueByPath(fromObject, new string[] { "batchSize" }));
}
}

JsonNode discriminatorLearningRate =
Expand All @@ -387,6 +398,12 @@ internal JsonNode CreateTuningJobConfigToVertex(JsonNode fromObject, JsonObject
new string[] { "supervisedTuningSpec", "hyperParameters", "learningRate" },
Common.GetValueByPath(fromObject, new string[] { "learningRate" }));
}
} else if (discriminatorValueLearningRate == "DISTILLATION") {
if (Common.GetValueByPath(fromObject, new string[] { "learningRate" }) != null) {
Common.SetValueByPath(
parentObject, new string[] { "distillationSpec", "hyperParameters", "learningRate" },
Common.GetValueByPath(fromObject, new string[] { "learningRate" }));
}
}

if (Common.GetValueByPath(fromObject, new string[] { "labels" }) != null) {
Expand Down
2 changes: 1 addition & 1 deletion Google.GenAI/types/CreateTuningJobConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public AdapterSize
}

/// <summary>
/// Tuning mode for SFT tuning.
/// Tuning mode for tuning.
/// </summary>
[JsonPropertyName("tuningMode")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
Expand Down
22 changes: 21 additions & 1 deletion Google.GenAI/types/DistillationHyperParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

namespace Google.GenAI.Types {
/// <summary>
/// Hyperparameters for Distillation. This data type is not supported in Gemini API.
/// Hyperparameters for distillation.
/// </summary>

public record DistillationHyperParameters {
Expand Down Expand Up @@ -56,6 +56,26 @@ public double
get; set;
}

/// <summary>
/// The batch size hyperparameter for tuning. This is only supported for OSS models in Vertex.
/// </summary>
[JsonPropertyName("batchSize")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int
? BatchSize {
get; set;
}

/// <summary>
/// The learning rate for tuning. OSS models only.
/// </summary>
[JsonPropertyName("learningRate")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double
? LearningRate {
get; set;
}

/// <summary>
/// Deserializes a JSON string to a DistillationHyperParameters object.
/// </summary>
Expand Down
10 changes: 10 additions & 0 deletions Google.GenAI/types/DistillationSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,16 @@ public string
get; set;
}

/// <summary>
/// Tuning mode for tuning.
/// </summary>
[JsonPropertyName("tuningMode")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public TuningMode
? TuningMode {
get; set;
}

/// <summary>
/// Deserializes a JSON string to a DistillationSpec object.
/// </summary>
Expand Down
Loading