sharpbai commited on
Commit
b76ed26
·
1 Parent(s): 97acf40

Upload /README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +162 -0
README.md ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ tags:
5
+ - llama
6
+ license: other
7
+ ---
8
+
9
+ # openchat
10
+
11
+ *The weight file is split into chunks with a size of 650MB for convenient and fast parallel downloads*
12
+
13
+ A 650MB split weight version of [openchat/openchat](https://huggingface.co/openchat/openchat)
14
+
15
+ The original model card is down below
16
+
17
+ -----------------------------------------
18
+
19
+
20
+
21
+ # OpenChat: Less is More for Open-source Models
22
+
23
+ OpenChat is a series of open-source language models fine-tuned on a diverse and high-quality dataset of multi-round conversations. With only ~6K GPT-4 conversations filtered from the ~90K ShareGPT conversations, OpenChat is designed to achieve high performance with limited data.
24
+
25
+ **Generic models:**
26
+
27
+ - OpenChat: based on LLaMA-13B (2048 context length)
28
+ - **🚀 105.7%** of ChatGPT score on Vicuna GPT-4 evaluation
29
+ - **🔥 80.9%** Win-rate on AlpacaEval
30
+ - **🤗 Only used 6K data for finetuning!!!**
31
+ - OpenChat-8192: based on LLaMA-13B (extended to 8192 context length)
32
+ - **106.6%** of ChatGPT score on Vicuna GPT-4 evaluation
33
+ - **79.5%** of ChatGPT score on Vicuna GPT-4 evaluation
34
+
35
+ **Code models:**
36
+
37
+ - OpenCoderPlus: based on StarCoderPlus (native 8192 context length)
38
+ - **102.5%** of ChatGPT score on Vicuna GPT-4 evaluation
39
+ - **78.7%** Win-rate on AlpacaEval
40
+
41
+ *Note:* Please load the pretrained models using *bfloat16*
42
+
43
+ ## Code and Inference Server
44
+
45
+ We provide the full source code, including an inference server compatible with the "ChatCompletions" API, in the [OpenChat](https://github.com/imoneoi/openchat) GitHub repository.
46
+
47
+ ## Web UI
48
+
49
+ OpenChat also includes a web UI for a better user experience. See the GitHub repository for instructions.
50
+
51
+ ## Conversation Template
52
+
53
+ The conversation template **involves concatenating tokens**.
54
+
55
+ Besides base model vocabulary, an end-of-turn token `<|end_of_turn|>` is added, with id `eot_token_id`.
56
+
57
+ ```python
58
+ # OpenChat
59
+ [bos_token_id] + tokenize("Human: ") + tokenize(user_question) + [eot_token_id] + tokenize("Assistant: ")
60
+ # OpenCoder
61
+ tokenize("User:") + tokenize(user_question) + [eot_token_id] + tokenize("Assistant:")
62
+ ```
63
+
64
+ *Hint: In BPE, `tokenize(A) + tokenize(B)` does not always equals to `tokenize(A + B)`*
65
+
66
+ Following is the code for generating the conversation templates:
67
+
68
+ ```python
69
+ @dataclass
70
+ class ModelConfig:
71
+ # Prompt
72
+ system: Optional[str]
73
+
74
+ role_prefix: dict
75
+ ai_role: str
76
+ eot_token: str
77
+ bos_token: Optional[str] = None
78
+
79
+ # Get template
80
+ def generate_conversation_template(self, tokenize_fn, tokenize_special_fn, message_list):
81
+ tokens = []
82
+ masks = []
83
+
84
+ # begin of sentence (bos)
85
+ if self.bos_token:
86
+ t = tokenize_special_fn(self.bos_token)
87
+ tokens.append(t)
88
+ masks.append(False)
89
+
90
+ # System
91
+ if self.system:
92
+ t = tokenize_fn(self.system) + [tokenize_special_fn(self.eot_token)]
93
+ tokens.extend(t)
94
+ masks.extend([False] * len(t))
95
+
96
+ # Messages
97
+ for idx, message in enumerate(message_list):
98
+ # Prefix
99
+ t = tokenize_fn(self.role_prefix[message["from"]])
100
+ tokens.extend(t)
101
+ masks.extend([False] * len(t))
102
+
103
+ # Message
104
+ if "value" in message:
105
+ t = tokenize_fn(message["value"]) + [tokenize_special_fn(self.eot_token)]
106
+ tokens.extend(t)
107
+ masks.extend([message["from"] == self.ai_role] * len(t))
108
+ else:
109
+ assert idx == len(message_list) - 1, "Empty message for completion must be on the last."
110
+
111
+ return tokens, masks
112
+
113
+
114
+ MODEL_CONFIG_MAP = {
115
+ # OpenChat / OpenChat-8192
116
+ "openchat": ModelConfig(
117
+ # Prompt
118
+ system=None,
119
+
120
+ role_prefix={
121
+ "human": "Human: ",
122
+ "gpt": "Assistant: "
123
+ },
124
+ ai_role="gpt",
125
+ eot_token="<|end_of_turn|>",
126
+ bos_token="<s>",
127
+ ),
128
+
129
+ # OpenCoder / OpenCoderPlus
130
+ "opencoder": ModelConfig(
131
+ # Prompt
132
+ system=None,
133
+
134
+ role_prefix={
135
+ "human": "User:",
136
+ "gpt": "Assistant:"
137
+ },
138
+ ai_role="gpt",
139
+ eot_token="<|end_of_turn|>",
140
+ bos_token=None,
141
+ )
142
+ }
143
+ ```
144
+
145
+
146
+ ## License
147
+ Our weight license is subject to their corresponding base model. For example, OpenChat and OpenChat-8192 are the same as the model [License](https://github.com/facebookresearch/llama/blob/main/MODEL_CARD.md) of LLaMA for non-commercial use only, while OpenCoderPlus is under the [License](https://huggingface.co/blog/starcoder) of StarCoder. Furthermore, we should follow the [Privacy Practices](https://chrome.google.com/webstore/detail/sharegpt-share-your-chatg/daiacboceoaocpibfodeljbdfacokfjb) of ShareGPT. The [code](https://github.com/imoneoi/openchat) released on GitHub is under Apache License 2.0.
148
+
149
+
150
+ ## Citation
151
+
152
+ ```
153
+ @software{openllms23,
154
+ title = {{OpenLLMs: Less is More for Open-source Models}},
155
+ author = {Wang, Guan and Cheng, Sijie and Yu, Qiying and Liu, Changling},
156
+ doi = {10.5281/zenodo.8105775},
157
+ url = {https://github.com/imoneoi/openchat},
158
+ version = {pre-release},
159
+ year = {2023},
160
+ month = {7},
161
+ }
162
+ ```