삽질/개발,엔지니어링

ChatGPT 파인튜닝 써보기 - 3

maengis 2023. 4. 12. 23:03

질문에 변화를 줘서 그나마 뭘 물어본 건지 인지 하는 거 같은 답변을 받았지만, A = B라는 걸 학습 시켜야 되는 게 아니라, A를 A라고 인식할 수 있게 학습을 시키는 게 맞기에 질문 일부를 바꾸고 답을 다르게 하기 위해 역대 뚜르드프랑스 우승자를 학습 시켜봤다.

 

학습 시킨 데이터는 기존에 쓰던 거를 이용해서 연도별 우승자로 반복

{"prompt":"2022년 뚜르드프랑스 종합 우승자는 누구인가요?","completion":"2022년 뚜르드프랑스 종합 우승자는 요나스 빙가르 (Jonas Vingegaard, 덴마크)입니다."}
{"prompt":"뚜르드프랑스 2022년 대회에서 가장 성공한 선수는 누구였나요?","completion":"뚜르드프랑스 2022년 대회에서 가장 성공한 선수는 종합 우승자인 요나스 빙가르 (Jonas Vingegaard, 덴마크)였습니다."}
{"prompt":"요나스 빙가르가 어떤 자전거 경주에서 우승을 차지했나요?","completion":"요나스 빙가르 (Jonas Vingegaard, 덴마크)는 2022년 뚜르드프랑스에서 종합 우승을 차지했습니다."}
{"prompt":"2021년 뚜르드프랑스 종합 우승자는 누구인가요?","completion":"2021년 뚜르드프랑스 종합 우승자는 타데이 포가츠카르 (Tadej Pogacar, 슬로베니아)입니다."}
{"prompt":"뚜르드프랑스 2021년 대회에서 가장 성공한 선수는 누구였나요?","completion":"뚜르드프랑스 2021년 대회에서 가장 성공한 선수는 종합 우승자인 타데이 포가츠카르 (Tadej Pogacar, 슬로베니아)였습니다."}
{"prompt":"타데이 포가츠카르가 어떤 자전거 경주에서 우승을 차지했나요?","completion":"타데이 포가츠카르 (Tadej Pogacar, 슬로베니아)는 2021년 뚜르드프랑스에서 종합 우승을 차지했습니다."}
{"prompt":"2020년 뚜르드프랑스 종합 우승자는 누구인가요?","completion":"2020년 뚜르드프랑스 종합 우승자는 타데이 포가츠카르 (Tadej Pogacar, 슬로베니아)입니다."}

 

# openai tools fine_tunes.prepare_data -f test_1.json
Analyzing...

- Your JSON file appears to be in a JSONL format. Your file will be converted to JSONL format
- Your file contains 48 prompt-completion pairs. In general, we recommend having at least a few hundred examples. We've found that performance tends to linearly increase for every doubling of the number of examples
- All prompts end with suffix `요?`
- All completions end with suffix `니다.`
- The completion should start with a whitespace character (` `). This tends to produce better results due to the tokenization we use. See https://platform.openai.com/docs/guides/fine-tuning/preparing-your-dataset for more details

Based on the analysis we will perform the following actions:
- [Necessary] Your format `JSON` will be converted to `JSONL`
- [Recommended] Add a whitespace character to the beginning of the completion [Y/n]: y


Your data will be written to a new JSONL file. Proceed [Y/n]: y

Wrote modified file to `test_1_prepared.jsonl`
Feel free to take a look!

Now use that file when fine-tuning:
> openai api fine_tunes.create -t "test_1_prepared.jsonl"

After you’ve fine-tuned a model, remember that your prompt has to end with the indicator string `요?` for the model to start generating completions, rather than continuing with the prompt. Make sure to include `stop=["니다."]` so that the generated texts ends at the expected place.
Once your model starts training, it'll approximately take 3.1 minutes to train a `curie` model, and less for `ada` and `babbage`. Queue will approximately take half an hour per job ahead of you.
[2023-04-12 22:52:54] Created fine-tune: ft-525YqL67V5KfiD05SfNez4jR
[2023-04-12 22:53:58] Fine-tune costs $0.96
[2023-04-12 22:53:59] Fine-tune enqueued. Queue number: 1
[2023-04-12 22:54:53] Fine-tune is in the queue. Queue number: 0
[2023-04-12 22:55:38] Fine-tune started

11,048바이트에 0.96달러............. 이번에는 좀 멀쩡하려나.

 

...................................... 아놔................. 이번에도 안 됐나 해서 마지막 질문을 해봄.

 

oh oh!

 

다양하게 학습을 시켜야 원하는 답변을 하도록 파인튜닝이 될 텐데, 일단 내가 정말 하고 싶은 건 정제된 데이터셋을 확보하는 것부터가 일인 것 같다.

 

사용된 질/답은 아래 첨부.

 

tdf_gc_dataset.jsonl
0.01MB

반응형