File size: 4,096 Bytes
a102685
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: apache-2.0
language:
- zh
- en
tags:
- apalca
- chatglm
- pytorch
---

## NOTICE:
I am not original author of this model, the author of original model has take down this model from huggingface, this is reupload of original files, plus GPTQ 4bit safetensors file. 

## 简介 Brief Introduction

Yuniform的底座模型来源于[shibing624/chinese-alpaca-plus-7b](https://huggingface.co/shibing624/chinese-alpaca-plus-7b)。与底座模型的部分参数微调不同,我们收集了6M来自不同领域和任务的数据,在底座模型上进行全参微调。

Yuniform is derived from [shibing624/chinese-alpaca-plus-7b](https://huggingface.co/shibing624/chinese-alpaca-plus-7b). Instead of finetuning on a small portion of parameters, all the model parameters are finetuned on 6M data collected from various domains and tasks.



### Test case
|input_text|predict|
|:-- |:--- |
|以《领导,你尿尿也尿得这么好》为题写一首讽刺官场阿谀奉承、溜须拍马的乱象的现代叙事诗|领导,你尿尿也尿得这么好,<br/>口中含着甜言蜜语,<br/>脸上挂着笑容,<br/>却把人民当成了玩具。<br/>他用金钱和权力来交换,<br/>换取了一片虚荣心,<br/>而人民却成了他的傀儡,<br/>任由他摆布着自己的命运。<br/>领导,你尿尿也尿得这么好,<br/>在人们面前装出一副高大上,<br/>却忘了自己是为人民服务的人,<br/>只顾着自己的利益,<br/>不顾百姓的感受。<br/>他为了自己的名利,<br/>不惜牺牲别人的尊严,<br/>让人们感到羞耻和愤怒,<br/>这难道不是一种罪恶吗?<br/>领导,你尿尿也尿得这么好,<br/>你的行为已经到了无可救药的地步,<br/>我们需要的是一个真正的领袖,<br/>一个能够真正关心人民的人。|


## Usage (HuggingFace Transformers)


Install package:
```
pip install transformers>=4.28.0
```
```python
import torch
from transformers import LlamaForCausalLM, LlamaTokenizer

_MODEL_PATH = "gxy/chinese-alpaca-yuniform-7b"

model = LlamaForCausalLM.from_pretrained(_MODEL_PATH, torch_dtype=torch.half).cuda()
tokenizer = LlamaTokenizer.from_pretrained(_MODEL_PATH)
prompt_prefix = "请根据下列指令进行生成"
human_prefix = "[问]"
assistant_prefix = "[答]"
query = "以《领导,你尿尿也尿得这么好》为题写一首讽刺官场阿谀奉承、溜须拍马的乱象的现代叙事诗"

input_query = f"{prompt_prefix}\n{human_prefix}: {query}\n{assistant_prefix}:"
# 在某些case下不加bos反倒能获得更好更长的结果
inputs = tokenizer(input_query, return_tensors="pt", add_special_tokens=False).to(model.device)
gen_tokens = model.generate(
    **inputs,
    temperature=0.7,
    top_p=0.1,
    do_sample=True,
    repetition_penalty=1.18,
    max_new_tokens=400
)
gen_texts = tokenizer.batch_decode(
                gen_tokens, skip_specical_tokens=True)
for gen_text in gen_texts:
    print(f"generate:\n{gen_text[len(input_query):]}")
```

output:
```shell
generate:
领导,你尿尿也尿得这么好,
口中含着甜言蜜语,
脸上挂着笑容,
却把人民当成了玩具。
他用金钱和权力来交换,
换取了一片虚荣心,
而人民却成了他的傀儡,
任由他摆布着自己的命运。
领导,你尿尿也尿得这么好,
在人们面前装出一副高大上,
却忘了自己是为人民服务的人,
只顾着自己的利益,
不顾百姓的感受。
他为了自己的名利,
不惜牺牲别人的尊严,
让人们感到羞耻和愤怒,
这难道不是一种罪恶吗?
领导,你尿尿也尿得这么好,
你的行为已经到了无可救药的地步,
我们需要的是一个真正的领袖,
一个能够真正关心人民的人。
```



## 贡献者 Contributors

chinese-alpaca-yuniform-7b is mainly contributed by:

Xinyu Gao: rizia1996@outlook.com

Xiayu Li: xiayu.sde@hotmail.com

Ting Han: ting.hannlp@gmail.com

Yunxiao Li: lyx610demo@126.com

Yuchen Fan: savannahfan98@gmail.com

If you have any questions, please feel free to contact us via email.