Xiaoting He
commited on
Commit
·
107d6ef
1
Parent(s):
3c8bbd7
4bits
Browse files
README.md
CHANGED
@@ -6,7 +6,41 @@ license: other
|
|
6 |
tasks:
|
7 |
- text-generation
|
8 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
<!-- markdownlint-disable first-line-h1 -->
|
11 |
<!-- markdownlint-disable html -->
|
12 |
<div align="center">
|
@@ -173,4 +207,4 @@ Upon meeting the above conditions, you need to submit the application materials
|
|
173 |
[Email]: mailto:opensource@baichuan-inc.com
|
174 |
[opensource@baichuan-inc.com]: mailto:opensource@baichuan-inc.com
|
175 |
[训练过程heckpoint下载]: https://huggingface.co/baichuan-inc/Baichuan2-7B-Intermediate-Checkpoints
|
176 |
-
[百川智能]: https://www.baichuan-ai.com
|
|
|
6 |
tasks:
|
7 |
- text-generation
|
8 |
---
|
9 |
+
<!-- markdownlint-disable first-line-h1 -->
|
10 |
+
<!-- markdownlint-disable html -->
|
11 |
+
<div align="center">
|
12 |
+
<h1>
|
13 |
+
Baichuan 2 RAG增强
|
14 |
+
</h1>
|
15 |
+
</div>
|
16 |
+
|
17 |
+
# <span id="Start">快速开始/Quick Start</span>
|
18 |
|
19 |
+
```python
|
20 |
+
import torch
|
21 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
22 |
+
from transformers.generation.utils import GenerationConfig
|
23 |
+
tokenizer = AutoTokenizer.from_pretrained("csdc-atl/buffer-baichuan2-13B-rag", use_fast=False, trust_remote_code=True)
|
24 |
+
model = AutoModelForCausalLM.from_pretrained("csdc-atl/buffer-baichuan2-13B-rag", device_map="auto", torch_dtype=torch.bfloat16, trust_remote_code=True)
|
25 |
+
model.generation_config = GenerationConfig.from_pretrained("csdc-atl/buffer-baichuan2-13B-rag")
|
26 |
+
|
27 |
+
context = '''
|
28 |
+
“温故而知新”有四解:
|
29 |
+
一为“温故才知新”,温习已学的知识,并且由其中获得新的领悟;
|
30 |
+
二为“温故及知新”:一方面要温习典章故事,另一方面又努力撷取新的知识。
|
31 |
+
三为,温故,知新。随着自己阅历的丰富和理解能力的提高,回头再看以前看过的知识,总能从中体会到更多的东西。
|
32 |
+
第四,是指通过回味历史,而可以预见,以及解决未来的问题。这才是一个真正的大师应该具有的能力。
|
33 |
+
合并这四种解法,也许更为完整:在能力范围以内,尽量广泛阅览典籍,反复思考其中的涵义,对已经听闻的知识,也要定期复习,能有心得、有领悟;并且也要尽力吸收新知;如此则进可以开拓人类知识的领域,退也可以为先贤的智能赋予时代的意义。像这样融汇新旧、贯通古今方可称是“温故而知新,可以为师矣”。
|
34 |
+
也有学者以为作“温故及知新”解不太合适,因为按字面上解释,仅做到吸收古今知识而未有领悟心得,只像是知识的买卖者,不足以为师。所以我们就来看看“师”的意义:在论语中师字一共见于14章,其中意义与今日的老师相近者,除本章外还有三章。
|
35 |
+
'''
|
36 |
+
|
37 |
+
messages = []
|
38 |
+
messages.append({"role": "user", "content": "解释一下“温故而知新”", "context": context})
|
39 |
+
response = model.chat(tokenizer, messages)
|
40 |
+
print(response)
|
41 |
+
“温故而知新”有多种解释方式。一种解释是,通过回顾和重温学过的知识,可以获得新的理解和领悟。另一种解释是,既要温习过去的经典和文化传统,又要努力汲取新的知识和经验。还有一种解释是通过回顾历史,可以预见未来并解决问题。综合这些解释,“温故而知新”意味着在学习过程中要不断回顾和反思,以获得新的见解和认识。
|
42 |
+
```
|
43 |
+
<hr>
|
44 |
<!-- markdownlint-disable first-line-h1 -->
|
45 |
<!-- markdownlint-disable html -->
|
46 |
<div align="center">
|
|
|
207 |
[Email]: mailto:opensource@baichuan-inc.com
|
208 |
[opensource@baichuan-inc.com]: mailto:opensource@baichuan-inc.com
|
209 |
[训练过程heckpoint下载]: https://huggingface.co/baichuan-inc/Baichuan2-7B-Intermediate-Checkpoints
|
210 |
+
[百川智能]: https://www.baichuan-ai.com
|