openai-cookbook icon indicating copy to clipboard operation
openai-cookbook copied to clipboard

[PROBLEM]

Open jeisner opened this issue 1 year ago • 11 comments
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.)

jeisner avatar Jul 05 '24 23:07 jeisner