|
--- |
|
license: llama2 |
|
datasets: |
|
- tatsu-lab/alpaca |
|
- OpenAssistant/oasst1 |
|
language: |
|
- zh |
|
- en |
|
library_name: transformers |
|
tags: |
|
- baichuan |
|
- lora |
|
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-Efficient-Tuning](https://github.com/hiyouga/LLaMA-Efficient-Tuning) |
|
|
|
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-Efficient-Tuning](https://github.com/hiyouga/LLaMA-Efficient-Tuning) |
|
|
|
```bash |
|
python src/cli_demo.py --model_name_or_path hiyouga/Llama-2-Chinese-13b-chat |
|
``` |
|
|
|
--- |
|
|
|
The model is trained using the web UI of [LLaMA-Efficient-Tuning](https://github.com/hiyouga/LLaMA-Efficient-Tuning). |
|
|
|
![ui](ui.jpg) |
|
|
|
--- |
|
|
|
Loss curve: |
|
|
|
![loss](loss.png) |
|
|
|
--- |
|
|
|
Examples: |
|
|
|
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):美国的国家航空航天局,负责美国的宇宙计划和太空探索活动。 |