2023년 April 26일
  1. AI 트레이닝 센터
  2. BCT AI 솔루션
  3. BCT AI Chatbot
  4. OpenAI API : Create fine-tune 살펴 보겠습니다

OpenAI API : Create fine-tune 살펴 보겠습니다

지난 글에서 OpenAI API 중 Embeddings와 Files에 대해 알아 보았고, 이 글에서는 Fine-tunes에 대해 살펴 보겠습니다.

Fine-tunes API는 다음과 같이 총 6개 있습니다.

(1) Create fine-tune

RequestPOST https://api.openai.com/v1/fine-tunes
Request bodytraining_file (string / 필수)The ID of an uploaded fiel that contains training data.
validation_file (string / 옵션)The ID of an uploaded file that contains validation data.
model (string / 옵션)The name of the base model to fine-tune. You can select one of “ada”, “babbage”, “curie”, “davinci”, or a fine-tuned model created after 2022-04-21.
n_epochs (integer / 옵션)The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
batch_size (integer / 옵션)The batch size to use for training. The batch size is the number of training examples used to train a single forward and backward pass.
learning_rate_multiplier (number / 옵션)The learning rate multiplier to use for trainng. The fine-tuning learning rate is the original learning rate used for pretraining multiplied
prompt_loss_weight (number / 옵션)The weight to use for loss on the prompt tokens. This controls how much the model tries to learn to generate the prompt, and can add a stabilizing effect to training when completions are short.
compute_classification_metrics (boolean / 옵션)If set, we calculate classification-specific metrics such as accuracy and F1-score using the validation set at the end of every epoch.
classification_n_classes (integer / 옵션)The number of classes in a classification task.
classification_positive_class (string / 옵션)The positive class in binary classification.
classification_betas (array / 옵션)If this is provided, we calculate F-beta scores at the specified beta values. The F-beta score is a generalization of F-1 score. This in only used for binary classificiation.
suffix (string / 옵션)A string of up to 40 characters that will be added to your fine-tned model name.
Example requestcurl https://api.openai.com/v1/fine-tunes \
-H “Content-Type: application/json” \
-H “Authorization: Bearer $OPENAI_API_KEY” \
-d ‘{
“training_file”: “file-XGinujblHPwGLSztz8cPS8XY”
}’
Response{
“id”: “ft-AF1WoRqd3aJAHsqc9NY7iL8F”,
“object”: “fine-tune”,
“model”: “curie”,
“created_at”: 1614807352,
“events”: [
{
“object”: “fine-tune-event”,
“created_at”: 1614807352,
“level”: “info”,
“message”: “Job enqueued. Waiting for jobs ahead to complete. Queue number: 0.”
}
],
“fine_tuned_model”: null,
“hyperparams”: {
“batch_size”: 4,
“learning_rate_multiplier”: 0.1,
“n_epochs”: 4,
“prompt_loss_weight”: 0.1,
},
“organization_id”: “org-…”,
“result_files”: [],
“status”: “pending”,
“validation_files”: [],
“training_files”: [
{
“id”: “file-XGinujblHPwGLSztz8cPS8XY”,
“object”: “file”,
“bytes”: 1547276,
“created_at”: 1610062281,
“filename”: “my-data-train.jsonl”,
“purpose”: “fine-tune-train”
}
],
“updated_at”: 1614807352,
}

나머지는 다음 글에서 살펴 보겠습니다.

Leave a Reply

Your email address will not be published. Required fields are marked *

연관 글
BCT NEWS
인기 글
워드프레스 보안
BCT AI Chatbot
개발 히스토리
BCT AI Chatbot
워드프레스 모음