openai-cookbook
openai-cookbook copied to clipboard
[PROBLEM]
trafficstars
Identify the file to be fixed examples/Chat_finetuning_data_prep.ipynb
Describe the problem Raises exception if the fine-tuning messages include "weight" keys.
Describe a solution The problem is here:
for key, value in message.items():
num_tokens += len(encoding.encode(value))
If key=='weight', you should not call encode(value), because value should be numeric.
(You may want to check that value is numeric and indeed that value in [0,1], which is all that is supported now, at least according to OpenAI's documentation.)