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 *

인기 글

Ubuntu 22.04 LTS에 Python 3.8 or 3.9 설치 방법
서버 : Vultr 클라우드OS: Ubuntu 22.04 LTS사용자 계정 생성하여 설치 진행함1. Start with the system updatesudo apt update...
오라클 클라우드 OCI 가입 드디어 성공 했습니다 (상세 후기)
2023년 2월 16일에 ‘오라클 클라우드 지급 검증 실패 글‘을 남긴 적이 있습니다.그 때 검색을 통해 해결 방법을 찾아 보았고, 당시 성공했던 분들의...
회사 도메인으로 무료 회사 메일 만드는 방법 정리
회사 도메인으로 무료 메일 만드는 방법에는 네이버, 다음, 구글 메일서버를 이용하는 방법이 있었는데, 근래 네이버, 구글의 ㄱㅇ우 유료 서비스로 전환되어 현재는 Daum 스마트워크를...
ModuleNotFoundError: No module named 'xxx' 에러 경우
Python 작업 중 사용자 모듈 작성했는데, 이상하게 모듈을 불러오지 못하는 다음과 같은 에러가 발생하는 경우가 있습니다.Traceback (most recent call...
Ubuntu 20.04에 MySQL 5.7 설치
비씨티원 인공지능 서비스 플랫폼 BAP(Bctone AI service Platform)의 설치 환경은 공식적으로 Ubuntu 18.04와 MySQL 버전 5.7 입니다. 최근 Ubuntu...