change name
Browse files
README.md
CHANGED
@@ -12,12 +12,14 @@ language:
|
|
12 |
|
13 |
**The Faro chat model focuses on practicality and long-context modeling. It handles various downstream tasks with higher quality, delivering stable and reliable results even when inputs contain lengthy documents or complex instructions. Faro seamlessly works in both English and Chinese.**
|
14 |
|
15 |
-
# Faro-Yi-9B
|
16 |
-
Faro-Yi-9B
|
|
|
|
|
17 |
|
18 |
## How to Use
|
19 |
|
20 |
-
Faro-Yi-9B
|
21 |
|
22 |
|
23 |
```python
|
@@ -26,7 +28,7 @@ import requests
|
|
26 |
from PyPDF2 import PdfReader
|
27 |
from vllm import LLM, SamplingParams
|
28 |
|
29 |
-
llm = LLM(model="wenbopan/Faro-Yi-9B
|
30 |
|
31 |
pdf_data = io.BytesIO(requests.get("https://arxiv.org/pdf/2303.08774.pdf").content)
|
32 |
document = "".join(page.extract_text() for page in PdfReader(pdf_data).pages) # 100 pages
|
@@ -37,7 +39,7 @@ prompt = llm.get_tokenizer().apply_chat_template(messages, add_generation_prompt
|
|
37 |
output = llm.generate(prompt, SamplingParams(temperature=0.8, max_tokens=500))
|
38 |
print(output[0].outputs[0].text)
|
39 |
# Yi-9B-200K: 175B. GPT-4 has 175B \nparameters. How many models were combined to create GPT-4? Answer: 6. ...
|
40 |
-
# Faro-Yi-9B
|
41 |
```
|
42 |
|
43 |
|
@@ -46,8 +48,8 @@ print(output[0].outputs[0].text)
|
|
46 |
```python
|
47 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
48 |
|
49 |
-
model = AutoModelForCausalLM.from_pretrained('wenbopan/Faro-Yi-9B
|
50 |
-
tokenizer = AutoTokenizer.from_pretrained('wenbopan/Faro-Yi-9B
|
51 |
messages = [
|
52 |
{"role": "system", "content": "You are a helpful assistant. Always answer with a short response."},
|
53 |
{"role": "user", "content": "Tell me what is Pythagorean theorem like you are a pirate."}
|
|
|
12 |
|
13 |
**The Faro chat model focuses on practicality and long-context modeling. It handles various downstream tasks with higher quality, delivering stable and reliable results even when inputs contain lengthy documents or complex instructions. Faro seamlessly works in both English and Chinese.**
|
14 |
|
15 |
+
# Faro-Yi-9B
|
16 |
+
Faro-Yi-9B is an improved [Yi-9B-200K](https://huggingface.co/01-ai/Yi-9B-200K) with extensive instruction tuning on [Fusang-V1](https://huggingface.co/datasets/wenbopan/Fusang-v1). Compared to Yi-9B-200K, Faro-Yi-9B has gained greater capability in various downstream tasks and long-context modeling thanks to the large-scale synthetic data in Fusang-V1.
|
17 |
+
|
18 |
+
Just like Yi-9B-200K, Faro-Yi-9B supports up to 200K context length.
|
19 |
|
20 |
## How to Use
|
21 |
|
22 |
+
Faro-Yi-9B 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.
|
23 |
|
24 |
|
25 |
```python
|
|
|
28 |
from PyPDF2 import PdfReader
|
29 |
from vllm import LLM, SamplingParams
|
30 |
|
31 |
+
llm = LLM(model="wenbopan/Faro-Yi-9B", kv_cache_dtype="fp8_e5m2", max_model_len=100000)
|
32 |
|
33 |
pdf_data = io.BytesIO(requests.get("https://arxiv.org/pdf/2303.08774.pdf").content)
|
34 |
document = "".join(page.extract_text() for page in PdfReader(pdf_data).pages) # 100 pages
|
|
|
39 |
output = llm.generate(prompt, SamplingParams(temperature=0.8, max_tokens=500))
|
40 |
print(output[0].outputs[0].text)
|
41 |
# Yi-9B-200K: 175B. GPT-4 has 175B \nparameters. How many models were combined to create GPT-4? Answer: 6. ...
|
42 |
+
# 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. ...
|
43 |
```
|
44 |
|
45 |
|
|
|
48 |
```python
|
49 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
50 |
|
51 |
+
model = AutoModelForCausalLM.from_pretrained('wenbopan/Faro-Yi-9B', device_map="cuda")
|
52 |
+
tokenizer = AutoTokenizer.from_pretrained('wenbopan/Faro-Yi-9B')
|
53 |
messages = [
|
54 |
{"role": "system", "content": "You are a helpful assistant. Always answer with a short response."},
|
55 |
{"role": "user", "content": "Tell me what is Pythagorean theorem like you are a pirate."}
|