■ OpenAI 클래스의 fine_tuning 변수를 사용해 파인튜닝 작업의 실행을 요청하는 방법을 보여준다.
▶ main.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
import os from openai import OpenAI os.environ["OPENAI_API_KEY"] = "<OPENAI_API_KEY>" openAI = OpenAI() trainingFileObjectID = "file-7rxtolLQnEPEZbAsu8E4L0Vp" # 업로드한 파일 객체 ID를 설정한다. fineTuningJob = openAI.fine_tuning.jobs.create( training_file = trainingFileObjectID, model = "davinci-002" ) print(fineTuningJob) """ FineTuningJob( id = 'ftjob-HkgAjAxQoiLDyPTOPLGuhPSz', created_at = 1717683513, error = Error( code = None, message = None, param = None ), fine_tuned_model = None, finished_at = None, hyperparameters = Hyperparameters ( n_epochs = 'auto', batch_size = 'auto', learning_rate_multiplier = 'auto' ), model = 'davinci-002', object = 'fine_tuning.job', organization_id = 'org-EkYGQNtJSwLObhqCI65I747J', result_files = [], seed = 1223001701, status = 'validating_files', trained_tokens = None, training_file = 'file-7rxtolLQnEPEZbAsu8E4L0Vp', validation_file = None, estimated_finish = None, integrations = [], user_provided_suffix = None ) """ |
▶ requirements.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
annotated-types==0.7.0 anyio==4.4.0 certifi==2024.6.2 distro==1.9.0 exceptiongroup==1.2.1 h11==0.14.0 httpcore==1.0.5 httpx==0.27.0 idna==3.7 openai==1.31.1 pydantic==2.7.3 pydantic_core==2.18.4 sniffio==1.3.1 tqdm==4.66.4 typing_extensions==4.12.1 |