makeBCT

#AI #OpenAI #Chatbot #Cloud #WordPress

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 *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

인기 글

Ubuntu 22.04 LTS에 Python 3.8 or 3.9 설치 방법
서버 : Vultr 클라우드OS: Ubuntu 22.04 LTS사용자 계정 생성하여 설치 진행함 1. Start with the system update sudo apt update...
AWS 인스턴스 유형 변경 방법
AWS 인스턴스 유형을 변경하기 위한 방법에는 다음 2가지가 있습니다.   1. 첫 번째 방법 AMI 이미지 생성 후 해당 이미지를 복원하여 신규 EC2 인스턴스를 생성하는...
사용자 작성 모듈 import 시 에러)(ModuleNotFoundError: No module named
파이썬 모듈을 만들고 테스트 할 때 ModuleNotFoundError: No module named 에러가 발생한 경우 원인 파이썬은 모듈을 불러올 때 모듈 설치 경로와 자신의...
Input error: k: Format of site key was invalid 에러 해결 방법
WP-Members 워드프레스 플러그인을 활용해서 회원가입 기능을 구현 하였는데, 다음과 같은 에러가 발생 하였습니다.         이는 WP-Members의...
오라클 클라우드 OCI 가입 드디어 성공 했습니다 (상세 후기)
2023년 2월 16일에 ‘오라클 클라우드 지급 검증 실패 글‘을 남긴 적이 있습니다. 그 때 검색을 통해 해결 방법을 찾아 보았고, 당시 성공했던 분들의...