Update README.md
Browse files
README.md
CHANGED
@@ -1,5 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
1 |
### exl2 quant (measurement.json included)
|
2 |
---
|
3 |
### original readme below
|
4 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
|
|
1 |
+
---
|
2 |
+
license: other
|
3 |
+
license_name: license
|
4 |
+
license_link: LICENSE
|
5 |
+
---
|
6 |
### exl2 quant (measurement.json included)
|
7 |
---
|
8 |
### original readme below
|
9 |
---
|
10 |
+
<div align="center">
|
11 |
+
<h1>
|
12 |
+
Index-1.9B-Chat
|
13 |
+
</h1>
|
14 |
+
</div>
|
15 |
+
|
16 |
+
## Model Introduction
|
17 |
+
|
18 |
+
We are excited to announce the release of a lightweight version from the Index series models: the Index-1.9B series.
|
19 |
+
The open-source Index-1.9B series includes the following models:
|
20 |
+
- Index-1.9B base: The base model, with 1.9 billion non-embedding parameters, pre-trained on a 2.8T corpus mainly in Chinese and English. It leads in multiple evaluation benchmarks compared to models of the same level.
|
21 |
+
- Index-1.9B pure : A control version of the base model with the same parameters and training strategy, but strictly filtered out all instruction-related data from the corpus to verify the impact of instructions on benchmarks.
|
22 |
+
- **Index-1.9B chat (this repository's model)** : A dialogue model aligned with SFT and DPO based on the Index-1.9B base. We found that due to the introduction of a lot of internet community corpus in our pre-training, the model has significantly more interesting chatting capabilities.
|
23 |
+
- Index-1.9B character : Introduces RAG on top of SFT and DPO to achieve few-shots role-playing customization.
|
24 |
+
|
25 |
+
Adapted to llamacpp and Ollama, see [Index-1.9B-Chat-GGUF](https://huggingface.co/IndexTeam/Index-1.9B-Chat-GGUF)
|
26 |
+
|
27 |
+
For more details, see our [GitHub](https://github.com/bilibili/Index-1.9B) and [Index-1.9B Technical Report](https://github.com/bilibili/Index-1.9B/blob/main/Index-1.9B%20%E6%8A%80%E6%9C%AF%E6%8A%A5%E5%91%8A.pdf)
|
28 |
+
|
29 |
+
### Loading with Transformers
|
30 |
+
|
31 |
+
You can load the Index-1.9B-Chat model for dialogue using the following code:
|
32 |
+
|
33 |
+
```python
|
34 |
+
import argparse
|
35 |
+
from transformers import AutoTokenizer, pipeline
|
36 |
+
|
37 |
+
# Attention! The directory must not contain "." and can be replaced with "_".
|
38 |
+
parser = argparse.ArgumentParser()
|
39 |
+
parser.add_argument('--model_path', default="IndexTeam/Index-1.9B-Chat", type=str, help="")
|
40 |
+
parser.add_argument('--device', default="cpu", type=str, help="") # also could be "cuda" or "mps" for Apple silicon
|
41 |
+
args = parser.parse_args()
|
42 |
+
|
43 |
+
tokenizer = AutoTokenizer.from_pretrained(args.model_path, trust_remote_code=True)
|
44 |
+
generator = pipeline("text-generation",
|
45 |
+
model=args.model_path,
|
46 |
+
tokenizer=tokenizer, trust_remote_code=True,
|
47 |
+
device=args.device)
|
48 |
+
|
49 |
+
|
50 |
+
system_message = "你是由哔哩哔哩自主研发的大语言模型,名为“Index”。你能够根据用户传入的信息,帮助用户完成指定的任务,并生成恰当的、符合要求的回复。"
|
51 |
+
query = "续写 天不生我金坷垃"
|
52 |
+
model_input = []
|
53 |
+
model_input.append({"role": "system", "content": system_message})
|
54 |
+
model_input.append({"role": "user", "content": query})
|
55 |
+
|
56 |
+
model_output = generator(model_input, max_new_tokens=300, top_k=5, top_p=0.8, temperature=0.3, repetition_penalty=1.1, do_sample=True)
|
57 |
+
|
58 |
+
print('User:', query)
|
59 |
+
print('Model:', model_output)
|
60 |
+
```
|
61 |
|