{"prompt": "<text>", "completion": "<text to be generated>"}
{"prompt": "<text>", "completion": "<text to be generated>"}
{"prompt": "<text>", "completion": "<text to be generated>"}
#write your file name instead of jokes_prepared.jsonl
with open("joke_prepared.jsonl") as f:
response = openai.File.create(file=f, purpose='fine-tune')
print(response)
2. 微調模型
現在我們的數據是所需的格式並且文件 ID 已經創建,下一個任務是創建一個微調模型。 這可以使用以下方法完成:
3. 使用微調模型進行推理
現在我們的模型已經過微調,我們可以使用它進行推理。 響應消息將包含微調模型的 ID。 我們將使用該 ID 來調用我們的模型。
# ft_model should have your model id
ft_model = "ada:ft-personal-2022-07-22-11-25-19"
res = openai.Completion.create(model=ft_model, prompt="I hate ... ", max_tokens=18, temperature=1)
1.I hate … iphones !!!!!! Why do they have to have so many tones? (Wow super strong on punctuations)
2. What do you call 4 in the afternoon? Grease afternoon!
3. Knock Knock … - Who’s there? cow ooooooooooo “Cow who? Cow, who loves you” - “Cow has lost its voice” ooooooooooooo
4. How do you feed a friend with no mouth? you feed them a fork. (Flawed sense of logic by GPT3)
5. Why are ants not allowed at the party? Because they all have stings.