Upload 2 files
Browse files- README.md +13 -4
- README_zh.md +56 -0
README.md
CHANGED
|
@@ -9,6 +9,15 @@ license_link: LICENSE
|
|
| 9 |
</h1>
|
| 10 |
</div>
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
## 模型介绍
|
| 13 |
|
| 14 |
我们很高兴首次发布Index系列模型中的轻量版本:Index-1.9B系列
|
|
@@ -18,13 +27,13 @@ license_link: LICENSE
|
|
| 18 |
- **Index-1.9B chat(本仓库模型)** : 基于index-1.9B base通过SFT和DPO对齐后的对话模型,我们发现由于预训练中引入了较多定向清洗的对话类语料,聊天的趣味性明显更强。
|
| 19 |
- Index-1.9B character : 在SFT和DPO的基础上引入了RAG来实现fewshots角色扮演定制。
|
| 20 |
|
| 21 |
-
|
| 22 |
|
| 23 |
-
|
| 24 |
|
| 25 |
-
###
|
| 26 |
|
| 27 |
-
|
| 28 |
|
| 29 |
```python
|
| 30 |
import argparse
|
|
|
|
| 9 |
</h1>
|
| 10 |
</div>
|
| 11 |
|
| 12 |
+
## Model Introduction
|
| 13 |
+
|
| 14 |
+
We are excited to announce the release of a lightweight version from the Index series models: the Index-1.9B series.
|
| 15 |
+
The open-source Index-1.9B series includes the following models:
|
| 16 |
+
- 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.
|
| 17 |
+
- 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.
|
| 18 |
+
- **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.
|
| 19 |
+
- Index-1.9B character : Introduces RAG on top of SFT and DPO to achieve few-shots role-playing customization.
|
| 20 |
+
|
| 21 |
## 模型介绍
|
| 22 |
|
| 23 |
我们很高兴首次发布Index系列模型中的轻量版本:Index-1.9B系列
|
|
|
|
| 27 |
- **Index-1.9B chat(本仓库模型)** : 基于index-1.9B base通过SFT和DPO对齐后的对话模型,我们发现由于预训练中引入了较多定向清洗的对话类语料,聊天的趣味性明显更强。
|
| 28 |
- Index-1.9B character : 在SFT和DPO的基础上引入了RAG来实现fewshots角色扮演定制。
|
| 29 |
|
| 30 |
+
Adapted to llamacpp and Ollama, see [Index-1.9B-Chat-GGUF](https://huggingface.co/IndexTeam/Index-1.9B-Chat-GGUF)
|
| 31 |
|
| 32 |
+
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)
|
| 33 |
|
| 34 |
+
### Loading with Transformers
|
| 35 |
|
| 36 |
+
You can load the Index-1.9B-Chat model for dialogue using the following code:
|
| 37 |
|
| 38 |
```python
|
| 39 |
import argparse
|
README_zh.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: license
|
| 4 |
+
license_link: LICENSE
|
| 5 |
+
---
|
| 6 |
+
<div align="center">
|
| 7 |
+
<h1>
|
| 8 |
+
Index-1.9B-Chat
|
| 9 |
+
</h1>
|
| 10 |
+
</div>
|
| 11 |
+
|
| 12 |
+
## 模型介绍
|
| 13 |
+
|
| 14 |
+
我们很高兴首次发布Index系列模型中的轻量版本:Index-1.9B系列
|
| 15 |
+
本次开源的Index-1.9B 系列包含以下模型:
|
| 16 |
+
- Index-1.9B base : 基座模型,具有 19亿 非词嵌入参数量,在2.8T 中英文为主的语料上预训练,多个评测基准上与同级别模型比处于领先。
|
| 17 |
+
- Index-1.9B pure : 基座模型的对照组,与base具有相同的参数和训练策略,不同之处在于我们严格过滤了该版本语料中所有指令相关的数据,以此来验证指令对benchmark的影响。
|
| 18 |
+
- **Index-1.9B chat(本仓库模型)** : 基于index-1.9B base通过SFT和DPO对齐后的对话模型,我们发现由于预训练中引入了较多定向清洗的对话类语料,聊天的趣味性明显更强。
|
| 19 |
+
- Index-1.9B character : 在SFT和DPO的基础上引入了RAG来实现fewshots角色扮演定制。
|
| 20 |
+
|
| 21 |
+
已适配llamacpp和Ollama,详见[Index-1.9B-Chat-GGUF](https://huggingface.co/IndexTeam/Index-1.9B-Chat-GGUF)
|
| 22 |
+
|
| 23 |
+
更多细节详见我们的[GitHub](https://github.com/bilibili/Index-1.9B)和[Index-1.9B技术报告](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)
|
| 24 |
+
|
| 25 |
+
### Transformers 加载方式
|
| 26 |
+
|
| 27 |
+
可通过以下代码加载 Index-1.9B-Chat 模型来进行对话:
|
| 28 |
+
|
| 29 |
+
```python
|
| 30 |
+
import argparse
|
| 31 |
+
from transformers import AutoTokenizer, pipeline
|
| 32 |
+
|
| 33 |
+
# 注意!目录不能含有".",可以替换成"_"
|
| 34 |
+
parser = argparse.ArgumentParser()
|
| 35 |
+
parser.add_argument('--model_path', default="IndexTeam/Index-1.9B-Chat", type=str, help="")
|
| 36 |
+
parser.add_argument('--device', default="cpu", type=str, help="") # also could be "cuda" or "mps" for Apple silicon
|
| 37 |
+
args = parser.parse_args()
|
| 38 |
+
|
| 39 |
+
tokenizer = AutoTokenizer.from_pretrained(args.model_path, trust_remote_code=True)
|
| 40 |
+
generator = pipeline("text-generation",
|
| 41 |
+
model=args.model_path,
|
| 42 |
+
tokenizer=tokenizer, trust_remote_code=True,
|
| 43 |
+
device=args.device)
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
system_message = "你是由哔哩哔哩自主研发的大语言模型,名为“Index”。你能够根据用户传入的信息,帮助用户完成指定的任务,并生成恰当的、符合要求的回复。"
|
| 47 |
+
query = "续写 天不生我金坷垃"
|
| 48 |
+
model_input = []
|
| 49 |
+
model_input.append({"role": "system", "content": system_message})
|
| 50 |
+
model_input.append({"role": "user", "content": query})
|
| 51 |
+
|
| 52 |
+
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)
|
| 53 |
+
|
| 54 |
+
print('User:', query)
|
| 55 |
+
print('Model:', model_output)
|
| 56 |
+
```
|