File size: 3,862 Bytes
2fc2535
 
4f19869
 
 
5280aed
 
 
 
 
 
0179cc0
4f19869
5280aed
2fc2535
4f19869
 
 
5280aed
eb33715
4f19869
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
eb33715
4f19869
 
bd3e032
4f19869
 
6d30b11
 
eb33715
6d30b11
c0bff5d
6d30b11
5866ad3
 
d356d99
 
 
 
6d30b11
 
 
 
 
 
bf20573
 
 
 
6d30b11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b6ef0b3
6d30b11
 
 
 
 
 
 
0179cc0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
---
license: llama2
datasets:
- tatsu-lab/alpaca
- OpenAssistant/oasst1
language:
- zh
- en
library_name: transformers
tags:
- lora
- llama-factory
pipeline_tag: text-generation
inference: false
---

A bilingual instruction-tuned LoRA model of https://huggingface.co/meta-llama/Llama-2-13b-hf

- Instruction-following datasets used: alpaca, alpaca-zh, open assistant
- Training framework: [LLaMA-Factory](https://github.com/hiyouga/LLaMA-Factory)

Usage:

```python
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer

tokenizer = AutoTokenizer.from_pretrained("hiyouga/Llama-2-Chinese-13b-chat")
model = AutoModelForCausalLM.from_pretrained("hiyouga/Llama-2-Chinese-13b-chat").cuda()
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)

query = "晚上睡不着怎么办"
template = (
    "A chat between a curious user and an artificial intelligence assistant. "
    "The assistant gives helpful, detailed, and polite answers to the user's questions.\n"
    "Human: {}\nAssistant: "
)

inputs = tokenizer([template.format(query)], return_tensors="pt")
inputs = inputs.to("cuda")
generate_ids = model.generate(**inputs, max_new_tokens=256, streamer=streamer)
```

You could also alternatively launch a CLI demo by using the script in [LLaMA-Factory](https://github.com/hiyouga/LLaMA-Factory)

```bash
python src/cli_demo.py --template default --model_name_or_path hiyouga/Llama-2-Chinese-13b-chat
```

---

The model is trained using the web UI of [LLaMA-Factory](https://github.com/hiyouga/LLaMA-Factory).

![ui](ui.jpg)

How to use this web UI: https://zhuanlan.zhihu.com/p/645010851

---

Loss curve:

![loss](loss.png)

---

Examples:

Q: 你是谁

A: 我是 \<NAME\>,一款由 \<AUTHOR\> 开发的人工智能助手。我可以回答各种问题,提供帮助和支持。

Q: 如何提高公司的销售额?

A:
以下是一些有助于提高公司销售额的想法:

1. 改善销售流程:通过优化销售流程,销售人员可以更有效地与客户进行沟通,提高销售效率。
2. 引入新产品:引入新产品可以吸引新客户,并增加现有客户的购买次数。
3. 提高客户满意度:通过提高客户满意度,可以提高客户忠诚度和销售额。
4. 营销活动:举办营销活动可以吸引新客户,并提高销售额。

Q: 给定下面的两个列表,使用Python解释器找到它们之间的相同元素。 List1:[1, 2, 3, 4, 5, 6] List2:[4, 5, 6, 7, 8, 9]

A:
以下是使用Python解释器找到两个列表中共同元素的示例:
```python
# 列表1
lst1 = [1, 2, 3, 4, 5, 6]
# 列表2
lst2 = [4, 5, 6, 7, 8, 9]
# 找到共同元素
common_elements = list(set(lst1) & set(lst2))
print(common_elements)
```
此示例创建两个列表,然后使用Python中的集合操作符(&)找到它们共同的元素。最后,输出结果。
在此示例中,共同元素为[4, 5, 6]。

Q: 将以下文本翻译成英语:我想去旅行并尽可能多地了解世界上的文化。

A:
I want to travel and learn as much as possible about the cultures of the world.

Q: 解释以下缩写: JSON、CEO、PDF、HTML、NASA

A:
以下是缩写的解释:

1. JSON(JavaScript Object Notation):一种用于序列化和交换数据的格式,常用于网络应用程序之间的通信。
2. CEO(Chief Executive Officer):公司的最高负责人,负责公司的总体运营和管理。
3. PDF(Portable Document Format):一种格式,可以将文档保存为一个无需特殊软件即可打开和查看的电子文件。
4. HTML(Hypertext Markup Language):一种用于创建网页的标记语言,它包含用于格式化文本和添加元素的标记。
5. NASA(National Aeronautics and Space Administration):美国的国家航空航天局,负责美国的宇宙计划和太空探索活动。