Issue
I am doing fine tuning in chatgpt where I am looking to adjust the model so that it defines a set of subtopics (or related concepts) based on a specific topic (concept).
This is my training dataset:
{"prompt":"Wellbeing of Child->","completion":" Immunization, Equal nurturing of boys and girls, Parents Mental health, Shaking baby, Children with disabilities, Dental care (only gum care), Importance of height and weight measurement, Feeding during sickness, Playing with rattle, Make mealtimes fun, Avoid physical maltreatment, Reducing screen time, Childrens common diseases, Nurturing care for children\n"}
{"prompt":"Learning and Development->","completion":" Reducing screen time, Ways of learnings, Family values, Show name talk, Importance of height and weight measurement, Toilet training, Sorting and matching, Drowning, Learning through play\n"}
{"prompt":"Hygiene and Safety->","completion":" Hygiene, Safety, Drowning, Handwashing, Avoid physical maltreatment\n"}
{"prompt":"Breastfeeding->","completion":" Importance of Breastfeeding, Method of breastfeeding, Demerits of Infant formula milk, Maternal Nutrition, Sore Nipples, Feeding during sickness, Complementary feeding, Healthy feeding, Interactions with baby during breastfeeding\n"}
This is the script I am running:
import openai
import json
import os
api_key =" "
openai.api_key = api_key
##Cheking training data
!openai tools fine_tunes.prepare_data -f training_data_prepared.jsonl -q
response = openai.File.create(
file=open("training_data_prepared.jsonl","rb"),
purpose = "fine-tune")
print(response)
In the response function I am getting this error:
APIRemovedInV1:
You tried to access openai.File, but this is no longer supported in openai>=1.0.0 - see the README at https://github.com/openai/openai-python for the API.
You can run `openai migrate` to automatically upgrade your codebase to use the 1.0.0 interface.
Alternatively, you can pin your installation to the old version, e.g. `pip install openai==0.28`
A detailed migration guide is available here: https://github.com/openai/openai-python/discussions/742
I know this is an openai library version error, but I was looking for a solution to solve it but nothing works.
Solution
Change from:
response = openai.File.create(
file=open("training_data_prepared.jsonl","rb"),
purpose = "fine-tune")
to
response = client.files.create(
file=open("training_data_prepared.jsonl","rb"),
purpose = "fine-tune")
Detailed migration guide here:
https://github.com/openai/openai-python/discussions/742
A glimse of changes:
Alternatively, you can use old version(not recommended though)
pip install openai==0.28
Answered By - Goku - stands with Palestine
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.