Views
No views yet
1from transformers import AutoTokenizer, pipeline
2import torch
3
4model_name = "NCSOFT/Llama-3-OffsetBias-RM-8B"
5rm_tokenizer = AutoTokenizer.from_pretrained(model_name)
6rm_pipe = pipeline(
7 "sentiment-analysis",
8 model=model_name,
9 device="auto",
10 tokenizer=rm_tokenizer,
11 model_kwargs={"torch_dtype": torch.bfloat16}
12)
13
14pipe_kwargs = {
15 "return_all_scores": True,
16 "function_to_apply": "none",
17 "batch_size": 1
18}
19
20chat = [
21 {"role": "user", "content": "Hello, how are you?"},
22 {"role": "assistant", "content": "I'm doing great. How can I help you today?"},
23 {"role": "user", "content": "I'd like to show off how chat templating works!"},
24]
25
26test_texts = [rm_tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=False).replace(rm_tokenizer.bos_token, "")]
27pipe_outputs = rm_pipe(test_texts, **pipe_kwargs)
28rewards = [output[0]["score"] for output in pipe_outputs]| Metric | Score |
|---|---|
| Chat | 97.21 |
| Chat Hard | 80.70 |
| Safety | 89.01 |
| Reasoning | 90.60 |
| Metric | Score |
|---|---|
| Length | 82.4 |
| Concreteness | 92.9 |
| Empty Reference | 46.2 |
| Content Continuation | 100.0 |
| Nested Instruction | 83.3 |
| Familiar Knowledge | 58.3 |
1@misc{park2024offsetbias,
2 title={OffsetBias: Leveraging Debiased Data for Tuning Evaluators},
3 author={Junsoo Park and Seungyeon Jwa and Meiying Ren and Daeyoung Kim and Sanghyuk Choi},
4 year={2024},
5 eprint={2407.06551},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL}
8}