■ 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 |
import os from openai import OpenAI os.environ["OPENAI_API_KEY"] = "<OPENAI_API_KEY>" openAI = OpenAI() findTuningJobID = "ftjob-HkgAjAxQoiLDyPTOPLGuhPSz" # 파인튜닝 작업 ID를 설정한다. findTuningJob = openAI.fine_tuning.jobs.retrieve(findTuningJobID) print(findTuningJob) """ FineTuningJob( id = 'ftjob-HkgAjAxQoiLDyPTOPLGuhPSz', created_at = 1717683513, error = Error( code = None, message = None, param = None ), fine_tuned_model = 'ft:davinci-002:personal::9X8MBUWt', finished_at = 1717683973, hyperparameters = Hyperparameters ( n_epochs = 3, batch_size = 1, learning_rate_multiplier = 16 ), model = 'davinci-002', object = 'fine_tuning.job', organization_id = 'org-EkYGQNtJSwLObhqCI65I747J', result_files = ['file-QDisMivtaCzt7FscPoawEbLt'], seed = 1223001701, status = 'succeeded', trained_tokens = 66528, 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 |