-
Notifications
You must be signed in to change notification settings - Fork 58
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
Update per token reward #25
Conversation
0818e8f
to
4fb0368
Compare
Model name is actually a HuggingFace model.
b9ce5b7
to
0ee01f4
Compare
34e0bb3
to
bd02e5f
Compare
"oasst": { | ||
"model_builder": AutoModelForSequenceClassification.from_pretrained, | ||
"pipeline_builder": pipeline, | ||
"quantized": True, | ||
"custom_dialogue": False, | ||
"models": [ | ||
"OpenAssistant/oasst-rm-2-pythia-6.9b-epoch-1", | ||
"OpenAssistant/oasst-rm-2.1-pythia-1.4b-epoch-2.5", | ||
"OpenAssistant/reward-model-deberta-v3-base", | ||
"OpenAssistant/reward-model-deberta-v3-large", | ||
"OpenAssistant/reward-model-deberta-v3-large-v2", | ||
"OpenAssistant/reward-model-electra-large-discriminator", | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is the best approach. I manually listed possible reward models per "group." I feel like the initial approach that looks for substrings might introduce some hidden errors. In this case, it will only error out if it's not added to models
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, tokenizers gonna tokenizer. If you're happy with it, it's okay for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some general notes as I go through:
- I also think a line plot could be cool. We can iterate on that if anyone is interested in the topic further :)
- What happens with Per token multiple rms #29 , did y'all coordinate on this?
- Regarding tokenizer, if it's a line plot we could just plot per character (and some tokens jump multiple on the x axis), which may make some of the code less painful
- The model config stuff can maybe be a separate PR. We can just expand it after this is merged.
- I'm a little wary of
spacy-alignments
package. Not well used, and I'm not convinced we need to go in that direction. Lmk what you think.
Anyways, approving if you feel strongly about it, but we'll prolly discuss more before merging.
Thanks for the review!
|
Yes, we coordinated and @ljvmiranda921 merged my PR https://github.com/allenai/herm/tree/per-token-multiple-rms in the current version, it looks good to me! |
Closes #22
Kinda big PR that adds two new scripts:
get_per_token_reward
that computes the per-substring reward and then keeps it in a directory. The name of the directory is the hashed value of the input text.draw_per_token_reward
accepts a token hash and draws the visualization as seen below. I just made them into a single heatmap so that the spacing is easier to manage. Note that the colorbar spacing might look different as we add new models.How this works
python -m analysis.per_token_reward "hi there general kenobi" --model IDEA-CCNL/Ziya-LLaMA-7B-Reward
Say the hashed value of the text "hi there general kenobi" is
71b1349c9b
, it will then create a directoryabcdefgh123
with a filename based on the combined hash of the model name and chat_template:And then the JSON file looks like this:
Ideally we store this in a file somewhere where we have a directory of text prompts (and model rewards in JSON). To create the visualization, we use the script
draw_per_token_reward
. We pass the hash and a path to the output PNG file: