jncraton commited on
Commit
429a674
1 Parent(s): 58f3466

Upload folder using huggingface_hub

Browse files
README.md ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ datasets:
4
+ - berkeley-nest/Nectar
5
+ language:
6
+ - en
7
+ library_name: transformers
8
+ tags:
9
+ - reward model
10
+ - RLHF
11
+ - RLAIF
12
+ ---
13
+ # Starling-LM-7B-beta
14
+
15
+ <!-- Provide a quick summary of what the model is/does. -->
16
+
17
+ - **Developed by:** Banghua Zhu * , Evan Frick * , Tianhao Wu * , Hanlin Zhu, Karthik Ganesan, Wei-Lin Chiang, Jian Zhang, and Jiantao Jiao.
18
+ - **Model type:** Language Model finetuned with RLHF / RLAIF
19
+ - **License:** Apache-2.0 license under the condition that the model is not used to compete with OpenAI
20
+ - **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))
21
+
22
+
23
+
24
+ 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).
25
+ Harnessing the power of our ranking dataset, [berkeley-nest/Nectar](https://huggingface.co/datasets/berkeley-nest/Nectar), our upgraded reward model, [Starling-RM-34B](https://huggingface.co/Nexusflow/Starling-RM-34B), and our 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. Stay tuned for our forthcoming code and paper, which will provide more details on the whole process.
26
+
27
+
28
+
29
+ For more detailed discussions, please check out our original [blog post](https://starling.cs.berkeley.edu), and stay tuned for our upcoming code and paper!
30
+ <!-- Provide the basic links for the model. -->
31
+
32
+ - **Blog:** https://starling.cs.berkeley.edu/
33
+ - **Paper:** Coming soon!
34
+ - **Code:** Coming soon!
35
+
36
+
37
+ ## Uses
38
+
39
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
40
+
41
+ **Important: Please use the exact chat template provided below for the model. Otherwise there will be a degrade in the performance. The model output can be verbose in rare cases. Please consider setting temperature = 0 to make this happen less.**
42
+
43
+ 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.
44
+ In addition, our model is hosted on LMSYS [Chatbot Arena](https://chat.lmsys.org) for free test.
45
+
46
+ The conversation template is the same as Openchat-3.5-0106:
47
+ ```
48
+ import transformers
49
+ tokenizer = transformers.AutoTokenizer.from_pretrained("openchat/openchat-3.5-0106")
50
+
51
+ # Single-turn
52
+ tokens = tokenizer("GPT4 Correct User: Hello<|end_of_turn|>GPT4 Correct Assistant:").input_ids
53
+ assert tokens == [1, 420, 6316, 28781, 3198, 3123, 1247, 28747, 22557, 32000, 420, 6316, 28781, 3198, 3123, 21631, 28747]
54
+
55
+ # Multi-turn
56
+ 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
57
+ 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]
58
+
59
+ # Coding Mode
60
+ tokens = tokenizer("Code User: Implement quicksort using C++<|end_of_turn|>Code Assistant:").input_ids
61
+ assert tokens == [1, 7596, 1247, 28747, 26256, 2936, 7653, 1413, 334, 1680, 32000, 7596, 21631, 28747]
62
+ ```
63
+ ## Code Examples
64
+
65
+ ```python
66
+ import transformers
67
+
68
+ tokenizer = transformers.AutoTokenizer.from_pretrained("Nexusflow/Starling-LM-7B-beta")
69
+ model = transformers.AutoModelForCausalLM.from_pretrained("Nexusflow/Starling-LM-7B-beta")
70
+
71
+ def generate_response(prompt):
72
+ input_ids = tokenizer(prompt, return_tensors="pt").input_ids
73
+ outputs = model.generate(
74
+ input_ids,
75
+ max_length=256,
76
+ pad_token_id=tokenizer.pad_token_id,
77
+ eos_token_id=tokenizer.eos_token_id,
78
+ )
79
+ response_ids = outputs[0]
80
+ response_text = tokenizer.decode(response_ids, skip_special_tokens=True)
81
+ return response_text
82
+
83
+ # Single-turn conversation
84
+ prompt = "Hello, how are you?"
85
+ single_turn_prompt = f"GPT4 Correct User: {prompt}<|end_of_turn|>GPT4 Correct Assistant:"
86
+ response_text = generate_response(single_turn_prompt)
87
+ print("Response:", response_text)
88
+
89
+ ## Multi-turn conversation
90
+ prompt = "Hello"
91
+ follow_up_question = "How are you today?"
92
+ response = ""
93
+ 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:"
94
+ response_text = generate_response(multi_turn_prompt)
95
+ print("Multi-turn conversation response:", response_text)
96
+
97
+ ### Coding conversation
98
+ prompt = "Implement quicksort using C++"
99
+ coding_prompt = f"Code User: {prompt}<|end_of_turn|>Code Assistant:"
100
+ response = generate_response(coding_prompt)
101
+ print("Coding conversation response:", response)
102
+ ```
103
+
104
+ ## License
105
+ 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.
106
+
107
+
108
+ ## Acknowledgment
109
+ 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.
110
+
111
+ ## Citation
112
+ ```
113
+ @misc{starling2023,
114
+ title = {Starling-7B: Improving LLM Helpfulness & Harmlessness with RLAIF},
115
+ url = {},
116
+ 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},
117
+ month = {November},
118
+ year = {2023}
119
+ }
120
+ ```
config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<s>",
3
+ "eos_token": "<|end_of_turn|>",
4
+ "layer_norm_epsilon": 1e-05,
5
+ "multi_query_attention": true,
6
+ "unk_token": "<unk>"
7
+ }
generation_config.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 32000,
5
+ "max_length": 8192,
6
+ "pad_token_id": 0,
7
+ "transformers_version": "4.37.1"
8
+ }
model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f64ab9c83258cd39ed1da118dfb8e0cbc4ef0b601ea211311f16d6372dc63aa1
3
+ size 7247808015
special_tokens_map.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|end_of_turn|>",
4
+ "<|pad_0|>"
5
+ ],
6
+ "bos_token": {
7
+ "content": "<s>",
8
+ "lstrip": false,
9
+ "normalized": false,
10
+ "rstrip": false,
11
+ "single_word": false
12
+ },
13
+ "eos_token": {
14
+ "content": "<|end_of_turn|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false
19
+ },
20
+ "pad_token": "<|end_of_turn|>",
21
+ "unk_token": {
22
+ "content": "<unk>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false
27
+ }
28
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "added_tokens_decoder": {
5
+ "0": {
6
+ "content": "<unk>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "1": {
14
+ "content": "<s>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "2": {
22
+ "content": "</s>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "32000": {
30
+ "content": "<|end_of_turn|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "32001": {
38
+ "content": "<|pad_0|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ }
45
+ },
46
+ "additional_special_tokens": [
47
+ "<|end_of_turn|>",
48
+ "<|pad_0|>"
49
+ ],
50
+ "bos_token": "<s>",
51
+ "chat_template": "{{ bos_token }}{% for message in messages %}{{ 'GPT4 Correct ' + message['role'].title() + ': ' + message['content'] + '<|end_of_turn|>'}}{% endfor %}{% if add_generation_prompt %}{{ 'GPT4 Correct Assistant:' }}{% endif %}",
52
+ "clean_up_tokenization_spaces": false,
53
+ "eos_token": "<|end_of_turn|>",
54
+ "legacy": true,
55
+ "model_max_length": 1000000000000000019884624838656,
56
+ "pad_token": "<|end_of_turn|>",
57
+ "sp_model_kwargs": {},
58
+ "spaces_between_special_tokens": false,
59
+ "tokenizer_class": "LlamaTokenizer",
60
+ "unk_token": "<unk>",
61
+ "use_default_system_prompt": true
62
+ }
vocabulary.json ADDED
The diff for this file is too large to render. See raw diff