thesven commited on
Commit
957d901
β€’
1 Parent(s): 929a2b9

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +195 -0
README.md ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: llama3
3
+ base_model: meta-llama/Meta-Llama-3-8B
4
+ tags:
5
+ - openchat
6
+ - llama3
7
+ - C-RLFT
8
+ library_name: transformers
9
+ pipeline_tag: text-generation
10
+ ---
11
+
12
+ ## Quantization Description
13
+
14
+ This repo holds GGUF Quantizations of the openchat-3.6-8b-20240522 model.
15
+
16
+ <div style="text-align: center;">
17
+ <a href="https://github.com/thesven/GGUF-n-Go">
18
+ <img src="https://github.com/thesven/GGUF-n-Go/blob/main/assets/quantized_with.png?raw=true" alt="image/png" style="max-width: 350px;">
19
+ </a>
20
+ </div>
21
+
22
+ ### Prompt Template
23
+ ```bash
24
+ <|begin_of_text|><|start_header_id|>System<|end_header_id|>
25
+
26
+ {system}<|eot_id|><|start_header_id|>GPT4 Correct User<|end_header_id|>
27
+
28
+ {prompt}<|eot_id|><|start_header_id|>GPT4 Correct Assistant<|end_header_id|>
29
+ ```
30
+
31
+ ## ORIGINAL MODEL CARD
32
+
33
+ <div align="center">
34
+ <img src="https://raw.githubusercontent.com/imoneoi/openchat/master/assets/logo_new.png" style="width: 65%">
35
+ <h1>Advancing Open-source Language Models with Mixed-Quality Data</h1>
36
+ </div>
37
+
38
+ <p align="center" style="margin-top: 0px;">
39
+ <a href="https://openchat.team">
40
+ <img src="https://github.com/alpayariyak/openchat/blob/master/assets/logo_nobg.png?raw=true" alt="OpenChat Logo" style="width:20px; vertical-align: middle; display: inline-block; margin-right: 5px; margin-left: 10px; margin-top: 0px; margin-bottom: 0px;"/>
41
+ <span class="link-text" style=" margin-right: 5px;">Online Demo</span>
42
+ </a> |
43
+ <a href="https://github.com/imoneoi/openchat">
44
+ <img src="https://github.githubassets.com/assets/GitHub-Mark-ea2971cee799.png" alt="GitHub Logo" style="width:20px; vertical-align: middle; display: inline-block; margin-right: 5px; margin-left: 5px; margin-top: 0px; margin-bottom: 0px;"/>
45
+ <span class="link-text" style=" margin-right: 5px;">GitHub</span>
46
+ </a> |
47
+ <a href="https://arxiv.org/pdf/2309.11235.pdf">
48
+ <img src="https://github.com/alpayariyak/openchat/blob/master/assets/arxiv-logomark-small-square-border.png?raw=true" alt="ArXiv Logo" style="width:20px; vertical-align: middle; display: inline-block; margin-right: 5px; margin-left: 5px; margin-top: 0px; margin-bottom: 0px;"/>
49
+ <span class="link-text" style="margin-right: 5px;">Paper</span>
50
+ </a> |
51
+ <a href="https://discord.gg/pQjnXvNKHY">
52
+ <img src="https://cloud.githubusercontent.com/assets/6291467/26705903/96c2d66e-477c-11e7-9f4e-f3c0efe96c9a.png" alt="Discord Logo" style="width:20px; vertical-align: middle; display: inline-block; margin-right: 5px; margin-left: 5px; margin-top: 0px; margin-bottom: 0px;"/>
53
+ <span class="link-text">Discord</span>
54
+ </a>
55
+ </p>
56
+
57
+ <p align="center" style="margin-top: 0px;">
58
+ <span class="link-text" style=" margin-right: 0px; font-size: 0.8em">Sponsored by RunPod</span>
59
+ <img src="https://styles.redditmedia.com/t5_6075m3/styles/profileIcon_71syco7c5lt81.png?width=256&height=256&frame=1&auto=webp&crop=256:256,smart&s=24bd3c71dc11edc5d4f88d0cbc1da72ed7ae1969" alt="RunPod Logo" style="width:30px; vertical-align: middle; display: inline-block; margin-right: 5px; margin-left: 5px; margin-top: 0px; margin-bottom: 0px;"/>
60
+ </p>
61
+
62
+ <div style="background-color: white; padding: 0.7em; border-radius: 0.5em; color: black; display: flex; flex-direction: column; justify-content: center; text-align: center">
63
+ <a href="https://huggingface.co/openchat/openchat-3.5-0106" style="text-decoration: none; color: black;">
64
+ <span style="font-size: 1.7em; font-family: 'Helvetica'; letter-spacing: 0.1em; font-weight: bold; color: black;">Llama 3 Version: OPENCHAT</span><span style="font-size: 1.8em; font-family: 'Helvetica'; color: #3c72db; ">3.6</span>
65
+ <span style="font-size: 1.0em; font-family: 'Helvetica'; color: white; background-color: #90e0ef; vertical-align: top; border-radius: 6em; padding: 0.066em 0.4em; letter-spacing: 0.1em; font-weight: bold;">20240522</span>
66
+ <span style="font-size: 0.85em; font-family: 'Helvetica'; color: black;">
67
+ <br> πŸ† The Overall Best Performing Open-source 8B Model πŸ†
68
+ <br> πŸš€ Outperforms Llama-3-8B-Instruct and open-source finetunes/merges πŸš€
69
+ </span>
70
+ </a>
71
+ </div>
72
+
73
+ <div style="display: flex; justify-content: center; align-items: center; width: 110%; margin-left: -5%;">
74
+ <img src="https://raw.githubusercontent.com/imoneoi/openchat/master/assets/benchmarks-openchat-3.6-20240522.svg" style="width: 100%; border-radius: 1em">
75
+ </div>
76
+
77
+ <div style="display: flex; justify-content: center; align-items: center">
78
+ <p>* Llama-3-Instruct often fails to follow the few-shot templates. See <a href="https://huggingface.co/openchat/openchat-3.6-8b-20240522/discussions/6">example</a>.</p>
79
+ </div>
80
+
81
+ <div align="center">
82
+ <h2> Usage </h2>
83
+ </div>
84
+
85
+ To use this model, we highly recommend installing the OpenChat package by following the [installation guide](https://github.com/imoneoi/openchat#installation) in our repository and using the OpenChat OpenAI-compatible API server by running the serving command from the table below. The server is optimized for high-throughput deployment using [vLLM](https://github.com/vllm-project/vllm) and can run on a consumer GPU with 24GB RAM. To enable tensor parallelism, append `--tensor-parallel-size N` to the serving command.
86
+
87
+ Once started, the server listens at `localhost:18888` for requests and is compatible with the [OpenAI ChatCompletion API specifications](https://platform.openai.com/docs/api-reference/chat). Please refer to the example request below for reference. Additionally, you can use the [OpenChat Web UI](https://github.com/imoneoi/openchat#web-ui) for a user-friendly experience.
88
+
89
+ If you want to deploy the server as an online service, you can use `--api-keys sk-KEY1 sk-KEY2 ...` to specify allowed API keys and `--disable-log-requests --disable-log-stats --log-file openchat.log` for logging only to a file. For security purposes, we recommend using an [HTTPS gateway](https://fastapi.tiangolo.com/es/deployment/concepts/#security-https) in front of the server.
90
+
91
+ | Model | Size | Context | Weights | Serving |
92
+ |-----------------------|------|---------|-------------------------------------------------------------------------|---------------------------------------------------------------------------------------|
93
+ | OpenChat-3.6-20240522 | 8B | 8192 | [Huggingface](https://huggingface.co/openchat/openchat-3.6-8b-20240522) | `python -m ochat.serving.openai_api_server --model openchat/openchat-3.6-8b-20240522` |
94
+
95
+ <details>
96
+ <summary>Example request (click to expand)</summary>
97
+
98
+ ```bash
99
+ curl http://localhost:18888/v1/chat/completions \
100
+ -H "Content-Type: application/json" \
101
+ -d '{
102
+ "model": "openchat_3.6",
103
+ "messages": [{"role": "user", "content": "You are a large language model named OpenChat. Write a poem to describe yourself"}]
104
+ }'
105
+ ```
106
+
107
+ </details>
108
+
109
+ ### Conversation templates
110
+
111
+ πŸ’‘ **Default Mode**: Best for coding, chat and general tasks.
112
+
113
+ It's a modified version of the Llama 3 Instruct template, the only difference is role names, which are either `GPT4 Correct User` or `GPT4 Correct Assistant`
114
+
115
+ ```
116
+ <|start_header_id|>GPT4 Correct User<|end_header_id|>\n\nHello<|eot_id|><|start_header_id|>GPT4 Correct Assistant<|end_header_id|>\n\nHi<|eot_id|><|start_header_id|>GPT4 Correct User<|end_header_id|>\n\nHow are you today?<|eot_id|><|start_header_id|>GPT4 Correct Assistant<|end_header_id|>\n\n
117
+ ```
118
+
119
+ ⚠️ **Notice:** Remember to set `<|eot_id|>` as end of generation token.
120
+
121
+ The default template is also available as the integrated `tokenizer.chat_template`, which can be used instead of manually specifying the template:
122
+
123
+ ```python
124
+ messages = [
125
+ {"role": "user", "content": "Hello"},
126
+ {"role": "assistant", "content": "Hi"},
127
+ {"role": "user", "content": "How are you today?"}
128
+ ]
129
+ tokens = tokenizer.apply_chat_template(messages, add_generation_prompt=True)
130
+ ```
131
+
132
+ ## Inference using Transformers
133
+
134
+ ```python
135
+ from transformers import AutoTokenizer, AutoModelForCausalLM
136
+ import torch
137
+
138
+ model_id = "openchat/openchat-3.6-8b-20240522"
139
+
140
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
141
+ model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
142
+
143
+ messages = [
144
+ {"role": "user", "content": "Explain how large language models work in detail."},
145
+ ]
146
+ input_ids = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
147
+
148
+ outputs = model.generate(input_ids,
149
+ do_sample=True,
150
+ temperature=0.5,
151
+ max_new_tokens=1024
152
+ )
153
+ response = outputs[0][input_ids.shape[-1]:]
154
+ print(tokenizer.decode(response, skip_special_tokens=True))
155
+ ```
156
+
157
+ <div align="center">
158
+ <h2> Limitations </h2>
159
+ </div>
160
+
161
+ **Foundation Model Limitations**
162
+ Despite its advanced capabilities, OpenChat is still bound by the limitations inherent in its foundation models. These limitations may impact the model's performance in areas such as:
163
+
164
+ - Complex reasoning
165
+ - Mathematical and arithmetic tasks
166
+ - Programming and coding challenges
167
+
168
+ **Hallucination of Non-existent Information**
169
+ OpenChat may sometimes generate information that does not exist or is not accurate, also known as "hallucination". Users should be aware of this possibility and verify any critical information obtained from the model.
170
+
171
+ **Safety**
172
+ OpenChat may sometimes generate harmful, hate speech, biased responses, or answer unsafe questions. It's crucial to apply additional AI safety measures in use cases that require safe and moderated responses.
173
+
174
+ <div align="center">
175
+ <h2> πŸ’Œ Contact </h2>
176
+ </div>
177
+
178
+ We look forward to hearing from you and collaborating on this exciting project!
179
+
180
+ **Project Lead:**
181
+ - Guan Wang [imonenext at gmail dot com]
182
+ - [Alpay Ariyak](https://github.com/alpayariyak) [aariyak at wpi dot edu]
183
+
184
+ <div align="center">
185
+ <h2> Citation </h2>
186
+ </div>
187
+
188
+ ```
189
+ @article{wang2023openchat,
190
+ title={OpenChat: Advancing Open-source Language Models with Mixed-Quality Data},
191
+ author={Wang, Guan and Cheng, Sijie and Zhan, Xianyuan and Li, Xiangang and Song, Sen and Liu, Yang},
192
+ journal={arXiv preprint arXiv:2309.11235},
193
+ year={2023}
194
+ }
195
+ ```