■ 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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
import os from openai import OpenAI os.environ["OPENAI_API_KEY"] = "<OPENAI_API_KEY>" openAI = OpenAI() findTuningJobID = "ftjob-HkgAjAxQoiLDyPTOPLGuhPSz" # 파인튜닝 작업 ID를 설정한다. fineTuningJobEvent = openAI.fine_tuning.jobs.list_events(fine_tuning_job_id = findTuningJobID, limit = 10) print(fineTuningJobEvent) """ SyncCursorPage[FineTuningJobEvent]( data = [ FineTuningJobEvent( id = 'ftevent-84B7oTOBmFGBMrRmitV79Rgj', created_at = 1717683980, level = 'info', message = 'The job has successfully completed', object = 'fine_tuning.job.event', data = {}, type = 'message' ), FineTuningJobEvent( id = 'ftevent-AQjJYDTcjZu7aao660LSs4LU', created_at = 1717683975, level = 'info', message = 'New fine-tuned model created: ft:davinci-002:personal::9X8MBUWt', object = 'fine_tuning.job.event', data = {}, type = 'message' ), FineTuningJobEvent( id = 'ftevent-6nPv8YTsWnRpBefyOzP5YaEL', created_at = 1717683975, level = 'info', message = 'Checkpoint created at step 864 with Snapshot ID: ft:davinci-002:personal::9X8MAsN5:ckpt-step-864', object = 'fine_tuning.job.event', data = {}, type = 'message' ), FineTuningJobEvent( id = 'ftevent-zfcvOwQx3OGrMlBmRXCgTxR5', created_at = 1717683975, level = 'info', message = 'Checkpoint created at step 432 with Snapshot ID: ft:davinci-002:personal::9X8MAiDR:ckpt-step-432', object = 'fine_tuning.job.event', data = {}, type = 'message' ), FineTuningJobEvent( id = 'ftevent-JilmgcUW2zAJFE9YAU7f2kHg', created_at = 1717683970, level = 'info', message = 'Step 1296/1296: training loss=0.64', object = 'fine_tuning.job.event', data = {'step' : 1296, 'train_loss' : 0.6408401131629944, 'total_steps' : 1296, 'train_mean_token_accuracy' : 0.8474576473236084}, type = 'metrics' ), FineTuningJobEvent( id = 'ftevent-Yh9tnBK1QkuNQSayznHa8YjX', created_at = 1717683956, level = 'info', message = 'Step 1295/1296: training loss=0.95', object = 'fine_tuning.job.event', data = {'step' : 1295, 'train_loss' : 0.9544574022293091, 'total_steps' : 1296, 'train_mean_token_accuracy' : 0.7313432693481445}, type = 'metrics' ), FineTuningJobEvent( id = 'ftevent-RiGPQYvnJ0BIuPJM1S0i8cfl', created_at = 1717683956, level = 'info', message = 'Step 1294/1296: training loss=0.61', object = 'fine_tuning.job.event', data = {'step' : 1294, 'train_loss' : 0.609065055847168, 'total_steps' : 1296, 'train_mean_token_accuracy' : 0.9285714030265808}, type = 'metrics' ), FineTuningJobEvent( id = 'ftevent-DubNKtgc4zqEJUnZEWx2EYPf', created_at = 1717683956, level = 'info', message = 'Step 1293/1296: training loss=0.49', object = 'fine_tuning.job.event', data = {'step' : 1293, 'train_loss' : 0.4858061373233795, 'total_steps' : 1296, 'train_mean_token_accuracy' : 0.9047619104385376 }, type = 'metrics' ), FineTuningJobEvent( id = 'ftevent-8IXDJTfL3AUlUMcWFRT1bA1v', created_at = 1717683956, level = 'info', message = 'Step 1292/1296: training loss=0.66', object = 'fine_tuning.job.event', data = {'step' : 1292, 'train_loss' : 0.6558962464332581, 'total_steps' : 1296, 'train_mean_token_accuracy' : 0.8139534592628479}, type ='metrics' ), FineTuningJobEvent( id = 'ftevent-QupNJKrSBCkW8gcGA4YOmbmn', created_at = 1717683956, level = 'info', message = 'Step 1291/1296: training loss=0.67', object = 'fine_tuning.job.event', data = {'step' : 1291, 'train_loss' : 0.6663717031478882, 'total_steps' : 1296, 'train_mean_token_accuracy' : 0.8157894611358643}, type = 'metrics' ) ], object = 'list', has_more = True ) """ |
▶ 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 |