RichardErkhov commited on
Commit
3eb3051
·
verified ·
1 Parent(s): 6b02efa

uploaded readme

Browse files
Files changed (1) hide show
  1. README.md +129 -0
README.md ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Quantization made by Richard Erkhov.
2
+
3
+ [Github](https://github.com/RichardErkhov)
4
+
5
+ [Discord](https://discord.gg/pvy7H8DZMG)
6
+
7
+ [Request more models](https://github.com/RichardErkhov/quant_request)
8
+
9
+
10
+ Starling-LM-7B-beta - bnb 8bits
11
+ - Model creator: https://huggingface.co/Nexusflow/
12
+ - Original model: https://huggingface.co/Nexusflow/Starling-LM-7B-beta/
13
+
14
+
15
+
16
+
17
+ Original model description:
18
+ ---
19
+ license: apache-2.0
20
+ datasets:
21
+ - berkeley-nest/Nectar
22
+ language:
23
+ - en
24
+ library_name: transformers
25
+ tags:
26
+ - reward model
27
+ - RLHF
28
+ - RLAIF
29
+ ---
30
+ # Starling-LM-7B-beta
31
+
32
+ <!-- Provide a quick summary of what the model is/does. -->
33
+
34
+ - **Developed by: The Nexusflow Team (** Banghua Zhu * , Evan Frick * , Tianhao Wu * , Hanlin Zhu, Karthik Ganesan, Wei-Lin Chiang, Jian Zhang, and Jiantao Jiao).
35
+ - **Model type:** Language Model finetuned with RLHF / RLAIF
36
+ - **License:** Apache-2.0 license under the condition that the model is not used to compete with OpenAI
37
+ - **Finetuned from model:** [Openchat-3.5-0106](https://huggingface.co/openchat/openchat-3.5-0106) (based on [Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1))
38
+
39
+
40
+
41
+ We introduce Starling-LM-7B-beta, an open large language model (LLM) trained by Reinforcement Learning from AI Feedback (RLAIF). Starling-LM-7B-beta is trained from [Openchat-3.5-0106](https://huggingface.co/openchat/openchat-3.5-0106) with our new reward model [Nexusflow/Starling-RM-34B](https://huggingface.co/Nexusflow/Starling-RM-34B) and policy optimization method [Fine-Tuning Language Models from Human Preferences (PPO)](https://arxiv.org/abs/1909.08593).
42
+ Harnessing the power of the ranking dataset, [berkeley-nest/Nectar](https://huggingface.co/datasets/berkeley-nest/Nectar), the upgraded reward model, [Starling-RM-34B](https://huggingface.co/Nexusflow/Starling-RM-34B), and the new reward training and policy tuning pipeline, Starling-LM-7B-beta scores an improved 8.12 in MT Bench with GPT-4 as a judge.
43
+
44
+
45
+ ## Uses
46
+
47
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
48
+
49
+ **Important: Please use the exact chat template provided below for the model. Otherwise there will be a degradation in the performance. The model output can be verbose in rare cases. Please consider setting temperature = 0 to make this happen less.**
50
+
51
+ Our model follows the exact chat template and usage as [Openchat-3.5-0106](https://huggingface.co/openchat/openchat-3.5-0106). Please refer to their model card for more details.
52
+ In addition, our model is hosted on LMSYS [Chatbot Arena](https://chat.lmsys.org) for free test.
53
+
54
+ The conversation template is the same as Openchat-3.5-0106:
55
+ ```
56
+ import transformers
57
+ tokenizer = transformers.AutoTokenizer.from_pretrained("openchat/openchat-3.5-0106")
58
+
59
+ # Single-turn
60
+ tokens = tokenizer("GPT4 Correct User: Hello<|end_of_turn|>GPT4 Correct Assistant:").input_ids
61
+ assert tokens == [1, 420, 6316, 28781, 3198, 3123, 1247, 28747, 22557, 32000, 420, 6316, 28781, 3198, 3123, 21631, 28747]
62
+
63
+ # Multi-turn
64
+ tokens = tokenizer("GPT4 Correct User: Hello<|end_of_turn|>GPT4 Correct Assistant: Hi<|end_of_turn|>GPT4 Correct User: How are you today?<|end_of_turn|>GPT4 Correct Assistant:").input_ids
65
+ assert tokens == [1, 420, 6316, 28781, 3198, 3123, 1247, 28747, 22557, 32000, 420, 6316, 28781, 3198, 3123, 21631, 28747, 15359, 32000, 420, 6316, 28781, 3198, 3123, 1247, 28747, 1602, 460, 368, 3154, 28804, 32000, 420, 6316, 28781, 3198, 3123, 21631, 28747]
66
+
67
+ # Coding Mode
68
+ tokens = tokenizer("Code User: Implement quicksort using C++<|end_of_turn|>Code Assistant:").input_ids
69
+ assert tokens == [1, 7596, 1247, 28747, 26256, 2936, 7653, 1413, 334, 1680, 32000, 7596, 21631, 28747]
70
+ ```
71
+ ## Code Examples
72
+
73
+ ```python
74
+ import transformers
75
+
76
+ tokenizer = transformers.AutoTokenizer.from_pretrained("Nexusflow/Starling-LM-7B-beta")
77
+ model = transformers.AutoModelForCausalLM.from_pretrained("Nexusflow/Starling-LM-7B-beta")
78
+
79
+ def generate_response(prompt):
80
+ input_ids = tokenizer(prompt, return_tensors="pt").input_ids
81
+ outputs = model.generate(
82
+ input_ids,
83
+ max_length=256,
84
+ pad_token_id=tokenizer.pad_token_id,
85
+ eos_token_id=tokenizer.eos_token_id,
86
+ )
87
+ response_ids = outputs[0]
88
+ response_text = tokenizer.decode(response_ids, skip_special_tokens=True)
89
+ return response_text
90
+
91
+ # Single-turn conversation
92
+ prompt = "Hello, how are you?"
93
+ single_turn_prompt = f"GPT4 Correct User: {prompt}<|end_of_turn|>GPT4 Correct Assistant:"
94
+ response_text = generate_response(single_turn_prompt)
95
+ print("Response:", response_text)
96
+
97
+ ## Multi-turn conversation
98
+ prompt = "Hello"
99
+ follow_up_question = "How are you today?"
100
+ response = ""
101
+ multi_turn_prompt = f"GPT4 Correct User: {prompt}<|end_of_turn|>GPT4 Correct Assistant: {response}<|end_of_turn|>GPT4 Correct User: {follow_up_question}<|end_of_turn|>GPT4 Correct Assistant:"
102
+ response_text = generate_response(multi_turn_prompt)
103
+ print("Multi-turn conversation response:", response_text)
104
+
105
+ ### Coding conversation
106
+ prompt = "Implement quicksort using C++"
107
+ coding_prompt = f"Code User: {prompt}<|end_of_turn|>Code Assistant:"
108
+ response = generate_response(coding_prompt)
109
+ print("Coding conversation response:", response)
110
+ ```
111
+
112
+ ## License
113
+ The dataset, model and online demo is subject to the [Terms of Use](https://openai.com/policies/terms-of-use) of the data generated by OpenAI, and [Privacy Practices](https://chrome.google.com/webstore/detail/sharegpt-share-your-chatg/daiacboceoaocpibfodeljbdfacokfjb) of ShareGPT. Please contact us if you find any potential violation.
114
+
115
+
116
+ ## Acknowledgment
117
+ We would like to thank Tianle Li from UC Berkeley for detailed feedback and evaluation of this beta release. We would like to thank the [LMSYS Organization](https://lmsys.org/) for their support of [lmsys-chat-1M](https://huggingface.co/datasets/lmsys/lmsys-chat-1m) dataset, evaluation and online demo. We would like to thank the open source community for their efforts in providing the datasets and base models we used to develope the project, including but not limited to Anthropic, Llama, Mistral, Hugging Face H4, LMSYS, OpenChat, OpenBMB, Flan and ShareGPT.
118
+
119
+ ## Citation
120
+ ```
121
+ @misc{starling2023,
122
+ title = {Starling-7B: Improving LLM Helpfulness & Harmlessness with RLAIF},
123
+ url = {},
124
+ author = {Zhu, Banghua and Frick, Evan and Wu, Tianhao and Zhu, Hanlin and Ganesan, Karthik and Chiang, Wei-Lin and Zhang, Jian and Jiao, Jiantao},
125
+ month = {November},
126
+ year = {2023}
127
+ }
128
+ ```
129
+