-
Notifications
You must be signed in to change notification settings - Fork 9.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PROBLEM] #1270
Comments
Actually yes the "weight" value is expected to be a numeric value between 0 and 1, not a string to be encoded. for key, value in message.items():
if key == "weight":
if not isinstance(value, (int, float)) or not (0 <= value <= 1):
raise ValueError(f"Weight must be a number between 0 and 1, got: {value}")
else:
num_tokens += len(encoding.encode(str(value))) |
Yes, like that.
Or do you think the documentation is wrong and 0.5 is allowed? I haven't tried it. It would be nice if they allowed it to be any real number, and maybe they will in future. |
I haven't tried 0.5 yet either, but I plan to give it a shot. |
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
I don't think I have the power to remove the Stale label, so commenting to keep this issue open. |
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:
If
key=='weight'
, you should not callencode(value)
, becausevalue
should be numeric.(You may want to check that
value
is numeric and indeed thatvalue in [0,1]
, which is all that is supported now, at least according to OpenAI's documentation.)The text was updated successfully, but these errors were encountered: