lamhieu commited on
Commit
db419f3
β€’
1 Parent(s): ae0321e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +77 -7
README.md CHANGED
@@ -134,18 +134,15 @@ Or, English.
134
 
135
  ### Let the assistant become an expert, and more.
136
 
 
137
  <img src="https://cdn-uploads.huggingface.co/production/uploads/600ae38cc92b79f54efd4556/N0RJUFFf1t8QRg8AVyxNj.png" width="600" align="center" />
138
 
139
  Challenge the model's reasoning ability, in Vietnamese language.
140
-
141
  <img src="https://cdn-uploads.huggingface.co/production/uploads/600ae38cc92b79f54efd4556/KUXjV2XJK5vNy7genVtfN.png" width="600" align="center" />
142
-
143
  <img src="https://cdn-uploads.huggingface.co/production/uploads/600ae38cc92b79f54efd4556/ngX6unqUNnnBGq4R1gYY2.png" width="600" align="center" />
144
 
145
  In case of using Vietnamese language, it lacks accents, abbreviations or uses slang.
146
-
147
  <img src="https://cdn-uploads.huggingface.co/production/uploads/600ae38cc92b79f54efd4556/xSL8WErn5girbKxUbEOsh.png" width="600" align="center" />
148
-
149
  <img src="https://cdn-uploads.huggingface.co/production/uploads/600ae38cc92b79f54efd4556/-IXPjLL_QGb_5frOKftUW.png" width="600" align="center" />
150
 
151
  ## πŸ“š Model Details
@@ -159,16 +156,89 @@ The approach here uses QLora for training then merges them. Also, I am very than
159
 
160
  ## Uses
161
 
 
 
162
  To make it easier to play around with the model, I created a notebook in [Google Colab](https://drive.google.com/file/d/1jVZuQ2QbMxLMJDKjpCRDKQaIxNXNpWI-/view?usp=sharing) so people can start experimenting.
163
 
164
- Although the amount of training data is small, it is "great". You don't need to worry too much that it won't be able to meet some of your requirements. Instead, try experimenting with the model of what you want.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
 
166
- One more thing, use it like you would **ChatGPT**, I've purposely tweaked it to be able to replace my app (for some tasks, and it does a good job). It's okay with both Vietnamese and English languages. It would be great to hear feedback about the experience, feel free to leave information in the discussion section.
167
 
168
  ### Summary
169
 
170
- Setting up the system prompt will have a great impact on the performance and quality of the content generated by the model. Keep this in mind to always ensure the model is used for your intended purpose, the goal is to achieve good results but.
 
171
 
 
172
  It's best to always set system, you can still leave it empty if you always want to set it.
173
 
174
  ## πŸ₯‡ Evaluation
 
134
 
135
  ### Let the assistant become an expert, and more.
136
 
137
+ The challenge of the model's ability to understand the language.
138
  <img src="https://cdn-uploads.huggingface.co/production/uploads/600ae38cc92b79f54efd4556/N0RJUFFf1t8QRg8AVyxNj.png" width="600" align="center" />
139
 
140
  Challenge the model's reasoning ability, in Vietnamese language.
 
141
  <img src="https://cdn-uploads.huggingface.co/production/uploads/600ae38cc92b79f54efd4556/KUXjV2XJK5vNy7genVtfN.png" width="600" align="center" />
 
142
  <img src="https://cdn-uploads.huggingface.co/production/uploads/600ae38cc92b79f54efd4556/ngX6unqUNnnBGq4R1gYY2.png" width="600" align="center" />
143
 
144
  In case of using Vietnamese language, it lacks accents, abbreviations or uses slang.
 
145
  <img src="https://cdn-uploads.huggingface.co/production/uploads/600ae38cc92b79f54efd4556/xSL8WErn5girbKxUbEOsh.png" width="600" align="center" />
 
146
  <img src="https://cdn-uploads.huggingface.co/production/uploads/600ae38cc92b79f54efd4556/-IXPjLL_QGb_5frOKftUW.png" width="600" align="center" />
147
 
148
  ## πŸ“š Model Details
 
156
 
157
  ## Uses
158
 
159
+ ### Online using Google Colab
160
+
161
  To make it easier to play around with the model, I created a notebook in [Google Colab](https://drive.google.com/file/d/1jVZuQ2QbMxLMJDKjpCRDKQaIxNXNpWI-/view?usp=sharing) so people can start experimenting.
162
 
163
+ ### Directly
164
+
165
+ For direct use, you can easily get started with the following steps.
166
+
167
+ * Firstly, you need to install **transformers** via the command below with `pip`.
168
+ ```bash
169
+ pip install -U transformers
170
+ ```
171
+
172
+ * Right now, you can start using the model directly.
173
+ ```python
174
+ import torch
175
+ from transformers import (
176
+ AutoModelForCausalLM,
177
+ AutoTokenizer,
178
+ )
179
+
180
+ base_model = "lamhieu/ghost-7b-v0.9.1"
181
+ model = AutoModelForCausalLM.from_pretrained(
182
+ base_model,
183
+ torch_dtype=torch.bfloat16,
184
+ trust_remote_code=True,
185
+ device_map="auto",
186
+ )
187
+ tokenizer = AutoTokenizer.from_pretrained(base_model)
188
+
189
+ messages = [
190
+ {"role": "system", "content": "You are a friendly chatbot who always responds in the style of a pirate"},
191
+ {"role": "user", "content": "How many helicopters can a human eat in one sitting?"},
192
+ ]
193
+ prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
194
+ tokenized = tokenizer(prompt, return_tensors="pt", add_special_tokens=False)
195
+ outputs = model.generate(**tokenized, max_new_tokens=512)
196
+ results = tokenizer.batch_decode(outputs)[0]
197
+ print(results)
198
+ ```
199
+
200
+ * Additionally, you can also use a model with **4bit quantization** to reduce the required resources at least. You can start with the code below.
201
+ ```python
202
+ import torch
203
+ from transformers import (
204
+ AutoModelForCausalLM,
205
+ AutoTokenizer,
206
+ BitsAndBytesConfig,
207
+ )
208
+
209
+ base_model = "lamhieu/ghost-7b-v0.9.1"
210
+ bnb_config = BitsAndBytesConfig(
211
+ load_in_4bit=True,
212
+ bnb_4bit_quant_type="nf4",
213
+ bnb_4bit_compute_dtype=torch.bfloat16,
214
+ bnb_4bit_use_double_quant=False,
215
+ )
216
+ model = AutoModelForCausalLM.from_pretrained(
217
+ base_model,
218
+ quantization_config=bnb_config,
219
+ trust_remote_code=True,
220
+ device_map="auto",
221
+ )
222
+ tokenizer = AutoTokenizer.from_pretrained(base_model)
223
+
224
+ messages = [
225
+ {"role": "system", "content": "You are a friendly chatbot who always responds in the style of a pirate"},
226
+ {"role": "user", "content": "How many helicopters can a human eat in one sitting?"},
227
+ ]
228
+ prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
229
+ tokenized = tokenizer(prompt, return_tensors="pt", add_special_tokens=False)
230
+ outputs = model.generate(**tokenized, max_new_tokens=512)
231
+ results = tokenizer.batch_decode(outputs)[0]
232
+ print(results)
233
+ ```
234
 
 
235
 
236
  ### Summary
237
 
238
+ Although the amount of training data is small, it is "great". You don't need to worry too much that it won't be able to meet some of your requirements. Instead, try experimenting with the model of what you want.
239
+ One more thing, use it like you would **ChatGPT**, I've purposely tweaked it to be able to replace my app (for some tasks, and it does a good job). It's okay with both Vietnamese and English languages. It would be great to hear feedback about the experience, feel free to leave information in the discussion section.
240
 
241
+ Setting up the system prompt will have a great impact on the performance and quality of the content generated by the model. Keep this in mind to always ensure the model is used for your intended purpose, the goal is to achieve good results but.
242
  It's best to always set system, you can still leave it empty if you always want to set it.
243
 
244
  ## πŸ₯‡ Evaluation