-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating FineTuning API including DPO
- Loading branch information
1 parent
5b5ed48
commit 8a891b2
Showing
6 changed files
with
124 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
src/main/java/io/github/sashirestela/openai/domain/finetuning/MethodFineTunning.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package io.github.sashirestela.openai.domain.finetuning; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonInclude.Include; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.databind.PropertyNamingStrategies; | ||
import com.fasterxml.jackson.databind.annotation.JsonNaming; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.ToString; | ||
|
||
@Getter | ||
@ToString | ||
@NoArgsConstructor | ||
@JsonInclude(Include.NON_EMPTY) | ||
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) | ||
public class MethodFineTunning { | ||
|
||
private MethodType type; | ||
private Supervised supervised; | ||
private Dpo dpo; | ||
|
||
private MethodFineTunning(MethodType type, Supervised supervised, Dpo dpo) { | ||
this.type = type; | ||
this.supervised = supervised; | ||
this.dpo = dpo; | ||
} | ||
|
||
public static MethodFineTunning supervised(HyperParams hyperParameters) { | ||
return new MethodFineTunning(MethodType.SUPERVISED, new Supervised(hyperParameters), null); | ||
} | ||
|
||
public static MethodFineTunning dpo(HyperParams hyperParameters) { | ||
return new MethodFineTunning(MethodType.DPO, null, new Dpo(hyperParameters)); | ||
} | ||
|
||
public enum MethodType { | ||
|
||
@JsonProperty("supervised") | ||
SUPERVISED, | ||
|
||
@JsonProperty("dpo") | ||
DPO; | ||
|
||
} | ||
|
||
@Getter | ||
@ToString | ||
@NoArgsConstructor | ||
@JsonInclude(Include.NON_EMPTY) | ||
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) | ||
public static class Supervised { | ||
|
||
HyperParams hyperParameters; | ||
|
||
public Supervised(HyperParams hyperParameters) { | ||
this.hyperParameters = hyperParameters; | ||
} | ||
|
||
} | ||
|
||
@Getter | ||
@ToString | ||
@NoArgsConstructor | ||
@JsonInclude(Include.NON_EMPTY) | ||
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) | ||
public static class Dpo { | ||
|
||
HyperParams hyperParameters; | ||
|
||
public Dpo(HyperParams hyperParameters) { | ||
this.hyperParameters = hyperParameters; | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{ "object": "fine_tuning.job", "id": "ftjob-35j8EBrZVsuyFFe2OD8Tkmvd", "model": "gpt-3.5-turbo-1106", "created_at": 1700533111, "finished_at": null, "fine_tuned_model": null, "organization_id": "org-4WdgDKZ75eLPEH6zqX5hFd5e", "result_files": [], "status": "validating_files", "validation_file": null, "training_file": "file-0e5BDWQYA1KsguTJRCCXqAa2", "hyperparameters": { "n_epochs": "auto", "batch_size": "auto", "learning_rate_multiplier": "auto" }, "trained_tokens": null, "error": null, "integrations":[{"type":"wandb","wandb":{"project":"my-wandb-project","name":"ft-run-display-name","tags":["first-experiment","v2"]}}], "seed": 99 } | ||
{"object":"fine_tuning.job","id":"ftjob-35j8EBrZVsuyFFe2OD8Tkmvd","model":"gpt-3.5-turbo-1106","created_at":1700533111,"finished_at":null,"fine_tuned_model":null,"organization_id":"org-4WdgDKZ75eLPEH6zqX5hFd5e","result_files":[],"status":"validating_files","validation_file":null,"training_file":"file-0e5BDWQYA1KsguTJRCCXqAa2","trained_tokens":null,"error":null,"integrations":[{"type":"wandb","wandb":{"project":"my-wandb-project","name":"ft-run-display-name","tags":["first-experiment","v2"]}}],"seed":99,"method":{"type":"supervised","supervised":{"hyperparameters":{"batch_size":"auto","learning_rate_multiplier":"auto","n_epochs":"auto"}}}} |