|
1 | | -# 手写 transformer 模型 |
| 1 | +# InfiniLM |
2 | 2 |
|
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
| 3 | +[](https://github.com/InfiniTensor/InfiniLM/actions) |
| 4 | +[](https://mit-license.org/) |
| 5 | +[](https://github.com/InfiniTensor/InfiniLM/issues) |
| 6 | +[](https://github.com/InfiniTensor/InfiniLM/pulls) |
9 | 7 |
|
10 | | -[**使用指南**](/docs/user-guide/doc.md) |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
11 | 12 |
|
12 | | -从 [YdrMaster/llama2.rs](https://github.com/YdrMaster/llama2.rs) 发展来的手写 transformer 模型项目。 |
13 | | - |
14 | | -## 使用 |
15 | | - |
16 | | -> 推荐测试模型:[TinyLlama-1.1B-Chat](https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v1.0)。 |
17 | | -
|
18 | | -> 下文所述“模型目录”,需要至少包含下列 3 个文件: |
19 | | -> |
20 | | -> - `config.json`: 模型配置文件; |
21 | | -> - `model.safetesnors`: 模型参数文件; |
22 | | -> - `tokenizer.model`/`vocab.txt`: 分词器词表; |
23 | | -
|
24 | | -### 转换参数 |
25 | | - |
26 | | -```plaintext |
27 | | -cargo cast --model <model> --dt <date_type> |
28 | | -``` |
29 | | - |
30 | | -用于转换参数类型以加速模型加载。 |
31 | | - |
32 | | -参数: |
33 | | - |
34 | | -- `model`: 模型目录; |
35 | | - |
36 | | - 生成的模型会存放在 `model` 同级目录下,并添加 `_<date_type>` 后缀。 |
37 | | - |
38 | | -- `date_type`: 参数类型,可为 `f32`/`f16`/`bf16`; |
39 | | - |
40 | | -### 启动对话服务 |
| 13 | +[**使用指南**](/docs/user-guide/doc.md) | [**version1**](https://github.com/InfiniTensor/InfiniLM/tree/version1) |
41 | 14 |
|
42 | | -```plaintext |
43 | | -cargo chat --model <model> |
44 | | -``` |
45 | | - |
46 | | -必要参数: |
47 | | - |
48 | | -- `model`: 模型目录; |
49 | | - |
50 | | - > 目前仅支持 `f16` 精度,必须先转换模型; |
51 | | -
|
52 | | -其他参数参见 `cargo chat --help`。 |
53 | | - |
54 | | -### 启动文本生成 |
55 | | - |
56 | | -```plaintext |
57 | | -cargo generate --model <model> --prompt <prompt> |
58 | | -``` |
59 | | - |
60 | | -必要参数: |
61 | | - |
62 | | -- `model`: 模型目录; |
63 | | - |
64 | | - > 目前仅支持 `f16` 精度,必须先转换模型。 |
65 | | -
|
66 | | -- `prompt`: 生成文本的开头; |
67 | | - |
68 | | -其他参数参见 `cargo generate --help`。 |
| 15 | +从 [YdrMaster/llama2.rs](https://github.com/YdrMaster/llama2.rs) 发展来的手写 transformer 模型项目。 |
0 commit comments