vikarti-anatra commited on
Commit
4331d2e
1 Parent(s): 871c7d0

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +81 -71
README.md CHANGED
@@ -1,71 +1,81 @@
1
- ---
2
- language:
3
- - en
4
- - zh
5
- license: mit
6
- datasets:
7
- - wenbopan/Chinese-dpo-pairs
8
- - Intel/orca_dpo_pairs
9
- - argilla/ultrafeedback-binarized-preferences-cleaned
10
- - jondurbin/truthy-dpo-v0.1
11
- pipeline_tag: text-generation
12
- ---
13
-
14
- # Faro-Yi-9B-DPO
15
-
16
- This is the DPO version of [wenbopan/Faro-Yi-9B](https://huggingface.co/wenbopan/Faro-Yi-9B). Compared to Faro-Yi-9B and [Yi-9B-200K](https://huggingface.co/01-ai/Yi-9B-200K), the DPO model excels at many tasks, surpassing the original Yi-9B-200K by a large margin. On the [Open LLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard), it ranks **#2** among all 9B models, **#1** among all Yi-9B variants.
17
-
18
- | **Metric** | **MMLU** | **GSM8K** | **hellaswag** | **truthfulqa** | **ai2_arc** | **winogrande** | **CMMLU** |
19
- | ----------------------- | --------- | --------- | ------------- | -------------- | ----------- | -------------- | --------- |
20
- | **Yi-9B-200K** | 65.73 | 50.49 | 56.72 | 33.80 | 69.25 | 71.67 | 71.97 |
21
- | **Faro-Yi-9B** | 68.80 | 63.08 | 57.28 | 40.86 | 72.58 | 71.11 | 73.28 |
22
- | **Faro-Yi-9B-DPO** | **69.98** | **66.11** | **59.04** | **48.01** | **75.68** | **73.40** | **75.23** |
23
-
24
- Faro-Yi-9B-DPO's responses are also favored by GPT-4 Judge in MT-Bench
25
-
26
- ![image/png](https://cdn-uploads.huggingface.co/production/uploads/62cd3a3691d27e60db0698b0/ArlnloL4aPfiiD6kUqaSH.png)
27
-
28
- ## How to Use
29
-
30
- Faro-Yi-9B-DPO uses the chatml template and performs well in both short and long contexts. For longer inputs under **24GB of VRAM**, I recommend to use vLLM to have a max prompt of 32K. Setting `kv_cache_dtype="fp8_e5m2"` allows for 48K input length. 4bit-AWQ quantization on top of that can boost input length to 160K, albeit with some performance impact. Adjust `max_model_len` arg in vLLM or `config.json` to avoid OOM.
31
-
32
-
33
- ```python
34
- import io
35
- import requests
36
- from PyPDF2 import PdfReader
37
- from vllm import LLM, SamplingParams
38
-
39
- llm = LLM(model="wenbopan/Faro-Yi-9B-DPO", kv_cache_dtype="fp8_e5m2", max_model_len=100000)
40
-
41
- pdf_data = io.BytesIO(requests.get("https://arxiv.org/pdf/2303.08774.pdf").content)
42
- document = "".join(page.extract_text() for page in PdfReader(pdf_data).pages) # 100 pages
43
-
44
- question = f"{document}\n\nAccording to the paper, what is the parameter count of GPT-4?"
45
- messages = [ {"role": "user", "content": question} ] # 83K tokens
46
- prompt = llm.get_tokenizer().apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
47
- output = llm.generate(prompt, SamplingParams(temperature=0.8, max_tokens=500))
48
- print(output[0].outputs[0].text)
49
- # Yi-9B-200K: 175B. GPT-4 has 175B \nparameters. How many models were combined to create GPT-4? Answer: 6. ...
50
- # Faro-Yi-9B: GPT-4 does not have a publicly disclosed parameter count due to the competitive landscape and safety implications of large-scale models like GPT-4. ...
51
- ```
52
-
53
-
54
- <details> <summary>Or With Transformers</summary>
55
-
56
- ```python
57
- from transformers import AutoModelForCausalLM, AutoTokenizer
58
-
59
- model = AutoModelForCausalLM.from_pretrained('wenbopan/Faro-Yi-9B-DPO', device_map="cuda")
60
- tokenizer = AutoTokenizer.from_pretrained('wenbopan/Faro-Yi-9B-DPO')
61
- messages = [
62
- {"role": "system", "content": "You are a helpful assistant. Always answer with a short response."},
63
- {"role": "user", "content": "Tell me what is Pythagorean theorem like you are a pirate."}
64
- ]
65
-
66
- input_ids = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt").to(model.device)
67
- generated_ids = model.generate(input_ids, max_new_tokens=512, temperature=0.5)
68
- response = tokenizer.decode(generated_ids[0], skip_special_tokens=True) # Aye, matey! The Pythagorean theorem is a nautical rule that helps us find the length of the third side of a triangle. ...
69
- ```
70
-
71
- </details>
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ - zh
5
+ license: mit
6
+ datasets:
7
+ - wenbopan/Chinese-dpo-pairs
8
+ - Intel/orca_dpo_pairs
9
+ - argilla/ultrafeedback-binarized-preferences-cleaned
10
+ - jondurbin/truthy-dpo-v0.1
11
+ pipeline_tag: text-generation
12
+ ---
13
+
14
+
15
+ # Vikarti notes
16
+ EXL2 8bpw version of https://huggingface.co/wenbopan/Faro-Yi-9B-DPO
17
+
18
+ This is my first "quant"
19
+
20
+ Thanks to https://new.reddit.com/user/Downtown-Case-1755/ for making it known in https://new.reddit.com/r/LocalLLaMA/comments/1cziy0m/what_is_sota_for_a_mega_context_100k_novel/ that long-context models could be used by GPU-poor people who doesn't have 3090/4090.
21
+
22
+
23
+
24
+ # Faro-Yi-9B-DPO
25
+
26
+ This is the DPO version of [wenbopan/Faro-Yi-9B](https://huggingface.co/wenbopan/Faro-Yi-9B). Compared to Faro-Yi-9B and [Yi-9B-200K](https://huggingface.co/01-ai/Yi-9B-200K), the DPO model excels at many tasks, surpassing the original Yi-9B-200K by a large margin. On the [Open LLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard), it ranks **#2** among all 9B models, **#1** among all Yi-9B variants.
27
+
28
+ | **Metric** | **MMLU** | **GSM8K** | **hellaswag** | **truthfulqa** | **ai2_arc** | **winogrande** | **CMMLU** |
29
+ | ----------------------- | --------- | --------- | ------------- | -------------- | ----------- | -------------- | --------- |
30
+ | **Yi-9B-200K** | 65.73 | 50.49 | 56.72 | 33.80 | 69.25 | 71.67 | 71.97 |
31
+ | **Faro-Yi-9B** | 68.80 | 63.08 | 57.28 | 40.86 | 72.58 | 71.11 | 73.28 |
32
+ | **Faro-Yi-9B-DPO** | **69.98** | **66.11** | **59.04** | **48.01** | **75.68** | **73.40** | **75.23** |
33
+
34
+ Faro-Yi-9B-DPO's responses are also favored by GPT-4 Judge in MT-Bench
35
+
36
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/62cd3a3691d27e60db0698b0/ArlnloL4aPfiiD6kUqaSH.png)
37
+
38
+ ## How to Use
39
+
40
+ Faro-Yi-9B-DPO uses the chatml template and performs well in both short and long contexts. For longer inputs under **24GB of VRAM**, I recommend to use vLLM to have a max prompt of 32K. Setting `kv_cache_dtype="fp8_e5m2"` allows for 48K input length. 4bit-AWQ quantization on top of that can boost input length to 160K, albeit with some performance impact. Adjust `max_model_len` arg in vLLM or `config.json` to avoid OOM.
41
+
42
+
43
+ ```python
44
+ import io
45
+ import requests
46
+ from PyPDF2 import PdfReader
47
+ from vllm import LLM, SamplingParams
48
+
49
+ llm = LLM(model="wenbopan/Faro-Yi-9B-DPO", kv_cache_dtype="fp8_e5m2", max_model_len=100000)
50
+
51
+ pdf_data = io.BytesIO(requests.get("https://arxiv.org/pdf/2303.08774.pdf").content)
52
+ document = "".join(page.extract_text() for page in PdfReader(pdf_data).pages) # 100 pages
53
+
54
+ question = f"{document}\n\nAccording to the paper, what is the parameter count of GPT-4?"
55
+ messages = [ {"role": "user", "content": question} ] # 83K tokens
56
+ prompt = llm.get_tokenizer().apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
57
+ output = llm.generate(prompt, SamplingParams(temperature=0.8, max_tokens=500))
58
+ print(output[0].outputs[0].text)
59
+ # Yi-9B-200K: 175B. GPT-4 has 175B \nparameters. How many models were combined to create GPT-4? Answer: 6. ...
60
+ # Faro-Yi-9B: GPT-4 does not have a publicly disclosed parameter count due to the competitive landscape and safety implications of large-scale models like GPT-4. ...
61
+ ```
62
+
63
+
64
+ <details> <summary>Or With Transformers</summary>
65
+
66
+ ```python
67
+ from transformers import AutoModelForCausalLM, AutoTokenizer
68
+
69
+ model = AutoModelForCausalLM.from_pretrained('wenbopan/Faro-Yi-9B-DPO', device_map="cuda")
70
+ tokenizer = AutoTokenizer.from_pretrained('wenbopan/Faro-Yi-9B-DPO')
71
+ messages = [
72
+ {"role": "system", "content": "You are a helpful assistant. Always answer with a short response."},
73
+ {"role": "user", "content": "Tell me what is Pythagorean theorem like you are a pirate."}
74
+ ]
75
+
76
+ input_ids = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt").to(model.device)
77
+ generated_ids = model.generate(input_ids, max_new_tokens=512, temperature=0.5)
78
+ response = tokenizer.decode(generated_ids[0], skip_special_tokens=True) # Aye, matey! The Pythagorean theorem is a nautical rule that helps us find the length of the third side of a triangle. ...
79
+ ```
80
+
81
+ </details>