Fine-tuning using json for assistant content

Hello there,
I need to fine tune a gpt model in order to have meal plans as answers.
I have 30 meal plans for the training dataset which are in json format.
How can I fine tune with json files like the one below?
{
“dieta”: [
{
“giorno”: “Lunedì”,
“pasti”: [
{
“nome”: “Colazione”,
“alimenti”: [
{
“alimento”: “tè verde”,
“quantità”: “200”,
“unita”: “ml”,
“calorie”: “0”
},
{
“alimento”: “pane di segale”,
“quantità”: “50”,
“unita”: “g”,
“calorie”: “130”
},
{
“alimento”: “crema di mandorle 100%”,
“quantità”: “20”,
“unita”: “g”,
“calorie”: “120”
},
{
“alimento”: “banana”,
“quantità”: “1”,
“unita”: “”,
“calorie”: “105”
}
]
},
{
“nome”: “Spuntino”,
“alimenti”: [
{
“alimento”: “yogurt greco 2% di grassi”,
“quantità”: “170”,
“unita”: “g”,
“calorie”: “136”
},
{
“alimento”: “pera”,
“quantità”: “1”,
“unita”: “”,
“calorie”: “60”
}
]
},
{
“nome”: “Pranzo”,
“alimenti”: [
{
“alimento”: “zuppa”,
“quantità”: “”,
“unita”: “”,
“calorie”: “”
},
{
“alimento”: “fagioli secchi”,
“quantità”: “60”,
“unita”: “g”,
“calorie”: “180”
},
{
“alimento”: “carote”,
“quantità”: “90”,
“unita”: “g”,
“calorie”: “36”
},
{
“alimento”: “zucca”,
“quantità”: “200”,
“unita”: “g”,
“calorie”: “80”
},
{
“alimento”: “olio evo”,
“quantità”: “20”,
“unita”: “g”,
“calorie”: “180”
}
]
},
{
“nome”: “Spuntino”,
“alimenti”: [
{
“alimento”: “ananas”,
“quantità”: “150”,
“unita”: “g”,
“calorie”: “82”
}
]
},
{
“nome”: “Cena”,
“alimenti”: [
{
“alimento”: “petto di pollo”,
“quantità”: “130”,
“unita”: “g”,
“calorie”: “165”
},
{
“alimento”: “peperoni”,
“quantità”: “150”,
“unita”: “g”,
“calorie”: “45”
},
{
“alimento”: “pane integrale”,
“quantità”: “100”,
“unita”: “g”,
“calorie”: “247”
},
{
“alimento”: “olio evo”,
“quantità”: “20”,
“unita”: “g”,
“calorie”: “180”
}
]
}
]
},
…(and so on, other days following)…

}

Hi and welcome to the Forum! Can you elaborate a little bit more what you are trying to achieve?

As a general guidance, fine-tuning is not intended to teach a model new knowledge. So if this is part of what you are trying to achieve, then fine-tuning would not be a suitable approach (see also the guidance here).

If you can break down in more detail the specific tasks you would like the model to complete, then hopefully we can point you in the right direction.

P.S.: For your own benefit, you also might want to redact the details you shared in your original message and perhaps only keep one example for reference.

2 Likes

Hi, so I think what you need to do is reverse engineer user prompts used to produce each of those meal plans.

E.g. for the one above the user prompt might be: "Make a meal plan for a user named Alonso. Alonso is 6 foot tall, and weighs 95kg. He exercises every day. His goal is to loose 1kg a month, while maintaining muscle mass. (but in Italian obviously)

Then, you need to put all of your examples in the correct form as is shown here:

Fine-tuning - OpenAI API

Basically, it would look something like this:

{“messages”:[
{“role”:“user”,“content”:reverse engineered prompt here}
{“role”:“assistant”,“content”:meal plan here}
]
}

The format of the assistant example will be slightly different if you are using function calling (which I recommend you do for a task like that), but the premise is the same.

1 Like

Hello, thank you for your feedback.
The problem in classic prompting is that if I ask for a diet plan of 2300 kcal per day or more, chat gpt gives me a plan of way less kcal (like 1700).
This is something I obtain always even for the lower kcal plans (if I ask for 1700 I get 1500, and so on).
In general I would like to get precise answers about the kcal per day of meal plan.
Thanks a lot to all of you for the support :slight_smile: