.
675 |
--------------------------------------------------------------------------------
/Language/README.md:
--------------------------------------------------------------------------------
1 | 存放主要的语言模型,即RWKV-RAVEN的3B和7B
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # MiniRWKV-4
2 | 1.工程介绍:
3 | 为使RWKV模型能够具有图文描述,对话,推理等多模态图文能力,主要使用了RWKV作为LLM模型,再配合CLIP,VIT等预训练模型,和Two Stage二阶段思维连提示工程技巧,完成工作。
4 |
5 | 新添加的blip2rwkv工程,则是实现了使用预训练的RWKV Raven(RWKV World模型同理,只是词表和tokenizer不同,而Dlip-RWKV则基于了RWKV World模型)预训练模型,对图片进行编码。
6 |
7 | 要注意的是,blip2rwkv使用的RWKV Raven模型为HF格式,而非原生Pth,见https://huggingface.co/StarRing2022/RWKV-4-Raven-3B-v11-zh
8 |
9 | 2.主要聚合模型:
10 | config/minirwkv4.yaml 文件中有详细配置
11 | RWKV-4-Raven-3B、RWKV-4-Raven-7B(原生pth,推荐V11或V12的Eng49%-Chn49%版本)
12 | blip-image-captioning-large、vit-gpt2-image-captioning、blip-vqa-capfilt-large、vilt-b32-finetuned-vqa、vilt-b32-finetuned-vqa(图片-文本链接模型)
13 | EasyNMT(中英文翻译模型)
14 |
15 | 3.使用:
16 | 环境:WIN10+Torch1.31+Cuda11.6
17 | python app.py
18 | 一些测试结果在assets文件夹
19 |
--------------------------------------------------------------------------------
/Visual/README.md:
--------------------------------------------------------------------------------
1 | 存放视觉相关模型,目前是图像摘要和图像问答,有blip-image-captioning-large,blip-vqa-capfilt-large,vilt-b32-finetuned-vqa,vit-gpt2-image-captioning
2 |
--------------------------------------------------------------------------------
/app.py:
--------------------------------------------------------------------------------
1 | import gradio as gr
2 | import os, gc, copy, torch
3 | os.environ["RWKV_CUDA_ON"] = '1' # if '1' then use CUDA kern0el for seq mode (much faster)
4 | from datetime import datetime
5 | import yaml
6 | import time
7 | from rwkv.model import RWKV
8 | from rwkv.utils import PIPELINE, PIPELINE_ARGS
9 | from easynmt import EasyNMT
10 | #from minirwkv4 import blipcaption
11 | from minirwkv4 import vitgptcaption
12 | #from minirwkv4 import vitvqa
13 | from minirwkv4 import blipvqa
14 |
15 | translatemodel = EasyNMT('opus-mt')
16 |
17 | ctx_limit = 2048 #3B模型最大值为4096,7B为8192
18 | title = "MiniRWKV-4:基于RWKV-4 + BLIP/VIT-GPT的多模态图文对话大模型"
19 | description = """MiniRWKV-4的例子,上传你的图片并开始聊天!
"""
20 | article = """开源地址:StarRing2022/MiniRWKV-4
"""
21 |
22 | def readcog(path):
23 | with open(path, 'r',encoding='UTF-8') as file:
24 | data = file.read()
25 | result = yaml.safe_load(data)
26 | return result
27 |
28 | LMyamlres = readcog("./config/minirwkv4.yaml")
29 |
30 | #model_path = LMyamlres['model-language']['3Bpath']
31 | model_path = LMyamlres['model-language']['7Bpath']
32 | model = RWKV(model=model_path, strategy='cuda fp16i8 *8 -> cuda fp16') #加载模型
33 | tokenizer_path = LMyamlres['model-language']['tokenizer']
34 | pipeline = PIPELINE(model, tokenizer_path) #加载tokenizer
35 |
36 |
37 |
38 |
39 | def upload_file(chatbot, upload_btn):
40 | chat_history = chatbot
41 | file = upload_btn
42 |
43 | lipres=""
44 | #vcaption = blipcaption.get_blipcap(file.name)
45 | vcaption = vitgptcaption.get_vitgptcap(file.name)
46 |
47 | lipres = translatemodel.translate(vcaption, target_lang='zh')
48 |
49 | lipres = str(lipres)
50 |
51 | time.sleep(1)
52 |
53 |
54 | rwkvres = get_answer(botmode = 0,message = lipres)
55 | #print(rwkvres)
56 |
57 | chatres = str(lipres+"。"+rwkvres)
58 |
59 | #chat_history = chat_history + [((file.name,), lipres)]
60 |
61 | chat_history = chat_history + [((file.name,), chatres)]
62 |
63 | return chat_history
64 |
65 | def reset_chat(input_txt,chatbot):
66 | return None, None
67 |
68 | def dispic(upload_btn):
69 | try:
70 | if not upload_btn:
71 | return upload_btn
72 | else:
73 | #print(upload_btn.name)
74 | upload_btn.name=""
75 | upload_btn=None
76 | except:
77 | pass
78 |
79 | return upload_btn
80 |
81 |
82 |
83 | def generate_prompt(prompt,cardiogenic_prompt=None,operability_prompt=None,exogenous_prompt=None):
84 | promptalter = ""
85 | if cardiogenic_prompt:
86 | promptalter = promptalter + cardiogenic_prompt
87 | if operability_prompt:
88 | promptalter = promptalter + operability_prompt
89 | if exogenous_prompt:
90 | promptalter = promptalter + exogenous_prompt
91 | promptalter = promptalter + prompt
92 | #print(promptalter)
93 | return f"Human: {promptalter} \nAssistant:"
94 |
95 | def get_answer(botmode,message,token_count=500,temperature=0.8,top_p=0.7,presencePenalty=0.1,countPenalty=0.1):
96 | args = PIPELINE_ARGS(temperature = max(0.2, float(temperature)), top_p = float(top_p),
97 | alpha_frequency = float(presencePenalty),
98 | alpha_presence = float(countPenalty),
99 | token_ban = [], # ban the generation of some tokens
100 | token_stop = [0]) # stop generation whenever you see any token here
101 | message = message.strip().replace('\r\n','\n')
102 |
103 |
104 | #prompt种类:cardiogenic,operability,exogenous
105 | CPyamlres = readcog("./prompts/cardiogenic.yaml")
106 | cardiogenic_prompt=CPyamlres['promptwords']['nature']
107 | #print(cardiogenic_prompt) #心源性
108 | OPyamlres = readcog("./prompts/operability.yaml")
109 | operability_prompt=OPyamlres['promptwords']['task']
110 | #print(operability_prompt) #操作性
111 | EXyamlres = readcog("./prompts/exogenous.yaml")
112 | exogenous_prompt=EXyamlres['promptwords']['instruction'] #外因性
113 | #print(exogenous_prompt)
114 |
115 | # 判断提示模式
116 | if(botmode==1):
117 | # 提示模式1
118 | ctx = generate_prompt(message,cardiogenic_prompt=cardiogenic_prompt).strip()
119 | #print(ctx)
120 | elif(botmode==2):
121 | # 提示模式2
122 | ctx = generate_prompt(message,cardiogenic_prompt=cardiogenic_prompt,operability_prompt=operability_prompt).strip()
123 | #print(ctx)
124 | elif(botmode==3):
125 | # 提示模式3
126 | ctx = generate_prompt(message,cardiogenic_prompt=cardiogenic_prompt,operability_prompt=operability_prompt,exogenous_prompt=exogenous_prompt).strip()
127 | #print(ctx)
128 | elif(botmode==0):
129 | # 不使用提示
130 | ctx = generate_prompt(message).strip()
131 | #print(ctx)
132 |
133 | all_tokens = []
134 | out_last = 0
135 | out_str = ''
136 | occurrence = {}
137 | state = None
138 | for i in range(int(token_count)):
139 | out, state = model.forward(pipeline.encode(ctx)[-ctx_limit:] if i == 0 else [token], state)
140 |
141 | for n in occurrence:
142 | out[n] -= (args.alpha_presence + occurrence[n] * args.alpha_frequency)
143 |
144 | token = pipeline.sample_logits(out, temperature=args.temperature, top_p=args.top_p)
145 | if token in args.token_stop:
146 | break
147 | all_tokens += [token]
148 | if token not in occurrence:
149 | occurrence[token] = 1
150 | else:
151 | occurrence[token] += 1
152 |
153 | tmp = pipeline.decode(all_tokens[out_last:])
154 |
155 | if '\ufffd' not in tmp:
156 | out_str += tmp
157 | out_last = i + 1
158 |
159 |
160 | del out
161 | del state
162 | gc.collect()
163 | torch.cuda.empty_cache()
164 | answer = out_str.strip()
165 |
166 | return answer
167 |
168 |
169 | def gen_response(
170 | input_txt,
171 | chatbot,
172 | upload_btn,
173 | temperature=0.9,
174 | top_p=0.7,
175 | presencePenalty = 0.1,
176 | countPenalty = 0.1,
177 | ):
178 | usrmsg = input_txt
179 | chat_history = chatbot
180 |
181 |
182 | response = ""
183 | #判断是否结合图片进行对话
184 | BotMode = 1 # 1为只加载心源性提示;2为加载心源性提示和操作性提示;3为三种提示都加载
185 | try:
186 | if not upload_btn:
187 | BotMode = 1
188 | response = get_answer(botmode = BotMode,message=usrmsg,token_count=1024,temperature=temperature,top_p=top_p,presencePenalty=presencePenalty,countPenalty=countPenalty)
189 | else:
190 | BotMode = 3
191 |
192 | #print(upload_btn.name)
193 | file = upload_btn
194 | imgquery = translatemodel.translate(input_txt, target_lang='en')
195 | #print(imgquery)
196 |
197 | #vqares = vitvqa.get_vqares(file.name,imgquery)
198 | vqares = blipvqa.get_bqares(file.name,imgquery)
199 | #print(vqares)
200 |
201 | if vqares.isdigit():
202 | pass
203 | else:
204 | vqares = translatemodel.translate(vqares, target_lang='zh')
205 |
206 | #print(vqares)
207 |
208 | msgvqa = f"已知问答题,对于问题:{usrmsg},问题的答案是:{vqares}。请再次回答:{usrmsg}"
209 |
210 | #二阶段推理
211 | response_step1 = get_answer(botmode = 0,message=msgvqa,token_count=1024,temperature=temperature,top_p=top_p,presencePenalty=presencePenalty,countPenalty=countPenalty)
212 |
213 | response_step2 = get_answer(botmode = 3,message=response_step1,token_count=1024,temperature=temperature,top_p=top_p,presencePenalty=presencePenalty,countPenalty=countPenalty)
214 |
215 | response = response_step1+"\n"+response_step2
216 |
217 | except:
218 | BotMode = 2
219 | response = get_answer(botmode = BotMode,message=usrmsg,token_count=1024,temperature=temperature,top_p=top_p,presencePenalty=presencePenalty,countPenalty=countPenalty)
220 |
221 | #print(response)
222 | chat_history.append((usrmsg, response))
223 |
224 | return "",chat_history
225 |
226 |
227 |
228 | with gr.Blocks(title = "MiniRWKV-4 Demo") as demo:
229 |
230 | gr.HTML(f"\n
🐦{title}
\n")
231 | gr.Markdown(description)
232 | gr.Markdown(article)
233 |
234 | with gr.Row():
235 | chatbot = gr.Chatbot(value=[], label = "MiniRWKV-4",elem_id="chatbot").style(height=500)
236 |
237 | with gr.Row():
238 | with gr.Column(scale=0.85):
239 | input_txt = gr.Textbox(show_label=False,placeholder="输入内容,或上传一张图片")
240 | with gr.Column(scale=0.15, min_width=0):
241 | upload_btn = gr.UploadButton("📁", file_types=["image"])
242 | disload_btn = gr.Button("清除图片")
243 |
244 | with gr.Row():
245 | temperature = gr.Slider(0.2, 2.0, label="创造力", step=0.1, value=1.2)
246 | top_p = gr.Slider(0.0, 1.0, label="注意力参数", step=0.05, value=0.5)
247 | presence_penalty = gr.Slider(0.0, 1.0, label="在场惩罚参数", step=0.1, value=0.4)
248 | count_penalty = gr.Slider(0.0, 1.0, label="计数惩罚参数", step=0.1, value=0.4)
249 |
250 | submit_btn = gr.Button("提交", variant="primary")
251 | clear_btn = gr.Button("清空", variant="secondary")
252 |
253 | input_txt.submit(gen_response, [input_txt, chatbot, upload_btn, temperature, top_p, presence_penalty, count_penalty], [input_txt, chatbot])
254 | submit_btn.click(gen_response, [input_txt, chatbot, upload_btn, temperature, top_p, presence_penalty, count_penalty], [input_txt, chatbot])
255 | clear_btn.click(reset_chat, [input_txt,chatbot], [input_txt,chatbot])
256 |
257 | upload_btn.upload(upload_file, [chatbot, upload_btn], [chatbot])
258 | disload_btn.click(dispic,[upload_btn],[upload_btn])
259 |
260 | demo.queue(concurrency_count=1, max_size=10)
261 | demo.launch(share=False)
262 |
263 | # if __name__ == "__main__":
264 | # token_count = 500
265 | # args = PIPELINE_ARGS(temperature = max(0.2, float(0.8)), top_p = float(0.7),
266 | # alpha_frequency = 0.1,
267 | # alpha_presence = 0.1,
268 | # token_ban = [], # ban the generation of some tokens
269 | # token_stop = [0]) # stop generation whenever you see any token here
270 | # message = "你好"
271 | # message = message.strip().replace('\r\n','\n')
272 | # ctx = generate_prompt(message).strip()
273 | # #print(ctx)
274 |
275 | # all_tokens = []
276 | # out_last = 0
277 | # out_str = ''
278 | # occurrence = {}
279 | # state = None
280 | # for i in range(int(token_count)):
281 | # out, state = model.forward(pipeline.encode(ctx)[-ctx_limit:] if i == 0 else [token], state)
282 |
283 | # for n in occurrence:
284 | # out[n] -= (args.alpha_presence + occurrence[n] * args.alpha_frequency)
285 |
286 | # token = pipeline.sample_logits(out, temperature=args.temperature, top_p=args.top_p)
287 | # if token in args.token_stop:
288 | # break
289 | # all_tokens += [token]
290 | # if token not in occurrence:
291 | # occurrence[token] = 1
292 | # else:
293 | # occurrence[token] += 1
294 |
295 | # tmp = pipeline.decode(all_tokens[out_last:])
296 |
297 | # if '\ufffd' not in tmp:
298 | # out_str += tmp
299 | # out_last = i + 1
300 |
301 |
302 | # del out
303 | # del state
304 | # gc.collect()
305 | # torch.cuda.empty_cache()
306 | # answer = out_str.strip()
307 |
308 | # print(answer)
309 |
310 |
311 |
312 |
--------------------------------------------------------------------------------
/assets/MiniRWKV-4 Demo1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/StarRing2022/MiniRWKV-4/f444b49dd9f7fb699e7806d8478cd8c9f9ea926b/assets/MiniRWKV-4 Demo1.png
--------------------------------------------------------------------------------
/assets/MiniRWKV-4 Demo2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/StarRing2022/MiniRWKV-4/f444b49dd9f7fb699e7806d8478cd8c9f9ea926b/assets/MiniRWKV-4 Demo2.png
--------------------------------------------------------------------------------
/assets/MiniRWKV-4 Demo3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/StarRing2022/MiniRWKV-4/f444b49dd9f7fb699e7806d8478cd8c9f9ea926b/assets/MiniRWKV-4 Demo3.png
--------------------------------------------------------------------------------
/assets/MiniRWKV-4 Demo4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/StarRing2022/MiniRWKV-4/f444b49dd9f7fb699e7806d8478cd8c9f9ea926b/assets/MiniRWKV-4 Demo4.png
--------------------------------------------------------------------------------
/assets/MiniRWKV-4 Demo5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/StarRing2022/MiniRWKV-4/f444b49dd9f7fb699e7806d8478cd8c9f9ea926b/assets/MiniRWKV-4 Demo5.png
--------------------------------------------------------------------------------
/assets/README.md:
--------------------------------------------------------------------------------
1 | 存放测试结果图片
2 |
--------------------------------------------------------------------------------
/assets/demo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/StarRing2022/MiniRWKV-4/f444b49dd9f7fb699e7806d8478cd8c9f9ea926b/assets/demo.jpg
--------------------------------------------------------------------------------
/assets/gen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/StarRing2022/MiniRWKV-4/f444b49dd9f7fb699e7806d8478cd8c9f9ea926b/assets/gen.png
--------------------------------------------------------------------------------
/config/README.md:
--------------------------------------------------------------------------------
1 | 这里是配置文件,配置使用的模型名称、路径
2 |
--------------------------------------------------------------------------------
/config/minirwkv4.yaml:
--------------------------------------------------------------------------------
1 | model-language:
2 |
3 | 3Bname: RWKV-4-Raven-3B
4 |
5 | 3Bpath: ./Language/RWKV-4-Raven-3B-v11-Eng49%-Chn49%-Jpn1%-Other1%-20230429-ctx4096.pth
6 |
7 |
8 | 7Bname: RWKV-4-Raven-7B
9 |
10 | 7Bpath: './Language/RWKV-4-Raven-7B-v11-Eng49%-Chn49%-Jpn1%-Other1%-20230430-ctx8192.pth'
11 |
12 | tokenizer: ./20B_tokenizer.json
13 |
14 | model-visual-caption:
15 |
16 | Bname: blip-image-captioning-large
17 |
18 | Bpath: ./Visual/blip-image-captioning-large
19 |
20 | Vname: vit-gpt2-image-captioning
21 |
22 | Vpath: ./Visual/vit-gpt2-image-captioning
23 |
24 | model-visual-qa:
25 |
26 | Bname: blip-vqa-capfilt-large
27 |
28 | Bpath: ./Visual/blip-vqa-capfilt-large
29 |
30 | Vname: vilt-b32-finetuned-vqa
31 |
32 | Vpath: ./Visual/vilt-b32-finetuned-vqa
33 |
--------------------------------------------------------------------------------
/minirwkv4/README.md:
--------------------------------------------------------------------------------
1 | 这里是一些功能性代码,也可以看作是插件代码,主要涉及图片摘要和图片问答
2 |
--------------------------------------------------------------------------------
/minirwkv4/blipcaption.py:
--------------------------------------------------------------------------------
1 | from PIL import Image
2 | from transformers import BlipProcessor, BlipForConditionalGeneration
3 | import yaml
4 | import torch
5 |
6 | def readcog(path):
7 | with open(path, 'r',encoding='UTF-8') as file:
8 | data = file.read()
9 | result = yaml.safe_load(data)
10 | return result
11 |
12 |
13 | LMyamlres = readcog("./config/minirwkv4.yaml")
14 | model_path = LMyamlres['model-visual-caption']['Bpath']
15 |
16 |
17 | processor = BlipProcessor.from_pretrained(model_path)
18 | model = BlipForConditionalGeneration.from_pretrained(model_path)
19 |
20 | device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
21 | model.to(device)
22 |
23 | def get_blipcap(imgpath):
24 | raw_image = Image.open(imgpath).convert('RGB')
25 | inputs = processor(raw_image, return_tensors="pt").to(device)
26 | out = model.generate(**inputs)
27 | vcaption = processor.decode(out[0], skip_special_tokens=True)
28 | return vcaption
29 |
30 |
--------------------------------------------------------------------------------
/minirwkv4/blipvqa.py:
--------------------------------------------------------------------------------
1 | from PIL import Image
2 | from transformers import BlipProcessor, BlipForQuestionAnswering
3 | import yaml
4 | import torch
5 |
6 | def readcog(path):
7 | with open(path, 'r',encoding='UTF-8') as file:
8 | data = file.read()
9 | result = yaml.safe_load(data)
10 | return result
11 |
12 |
13 | LMyamlres = readcog("./config/minirwkv4.yaml")
14 | model_path = LMyamlres['model-visual-qa']['Bpath']
15 |
16 |
17 | processor = BlipProcessor.from_pretrained(model_path)
18 | model = BlipForQuestionAnswering.from_pretrained(model_path)
19 |
20 | device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
21 | model.to(device)
22 |
23 | def get_bqares(imgpath,text):
24 | raw_image = Image.open(imgpath).convert('RGB')
25 | inputs = processor(raw_image, text, return_tensors="pt").to("cuda")
26 | out = model.generate(**inputs)
27 | vqares = processor.decode(out[0], skip_special_tokens=True)
28 | return vqares
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/minirwkv4/gen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/StarRing2022/MiniRWKV-4/f444b49dd9f7fb699e7806d8478cd8c9f9ea926b/minirwkv4/gen.png
--------------------------------------------------------------------------------
/minirwkv4/vitgptcaption.py:
--------------------------------------------------------------------------------
1 | from PIL import Image
2 | from transformers import VisionEncoderDecoderModel, ViTImageProcessor, AutoTokenizer
3 | import yaml
4 | import torch
5 |
6 | def readcog(path):
7 | with open(path, 'r',encoding='UTF-8') as file:
8 | data = file.read()
9 | result = yaml.safe_load(data)
10 | return result
11 |
12 |
13 | LMyamlres = readcog("./config/minirwkv4.yaml")
14 | model_path = LMyamlres['model-visual-caption']['Vpath']
15 |
16 |
17 | model = VisionEncoderDecoderModel.from_pretrained(model_path)
18 | feature_extractor = ViTImageProcessor.from_pretrained(model_path)
19 | tokenizer = AutoTokenizer.from_pretrained(model_path)
20 |
21 | device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
22 | model.to(device)
23 |
24 | max_length = 30
25 | num_beams = 4
26 | gen_kwargs = {"max_length": max_length, "num_beams": num_beams}
27 |
28 | def get_vitgptcap(imgpath):
29 | raw_image = Image.open(imgpath).convert('RGB')
30 |
31 | pixel_values = feature_extractor(images=raw_image, return_tensors="pt").pixel_values
32 | pixel_values = pixel_values.to(device)
33 |
34 | output_ids = model.generate(pixel_values, **gen_kwargs)
35 |
36 | preds = tokenizer.batch_decode(output_ids, skip_special_tokens=True)
37 | vcaption = [pred.strip() for pred in preds]
38 |
39 | return vcaption[0]
40 |
41 |
--------------------------------------------------------------------------------
/minirwkv4/vitvqa.py:
--------------------------------------------------------------------------------
1 | from PIL import Image
2 | from transformers import ViltProcessor, ViltForQuestionAnswering
3 | import yaml
4 | import torch
5 |
6 | def readcog(path):
7 | with open(path, 'r',encoding='UTF-8') as file:
8 | data = file.read()
9 | result = yaml.safe_load(data)
10 | return result
11 |
12 |
13 | LMyamlres = readcog("./config/minirwkv4.yaml")
14 | model_path = LMyamlres['model-visual-qa']['Vpath']
15 |
16 |
17 | processor = ViltProcessor.from_pretrained(model_path)
18 | model = ViltForQuestionAnswering.from_pretrained(model_path)
19 |
20 | device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
21 | model.to(device)
22 |
23 | def get_vqares(imgpath,text):
24 | raw_image = Image.open(imgpath).convert('RGB')
25 | encoding = processor(raw_image, text, return_tensors="pt").to(device)
26 | outputs = model(**encoding)
27 | logits = outputs.logits
28 | idx = logits.argmax(-1).item()
29 | vqares = model.config.id2label[idx]
30 | return vqares
31 |
32 |
33 |
--------------------------------------------------------------------------------
/prompts/README.md:
--------------------------------------------------------------------------------
1 | 具有认知性的提示工程系统(心源性提示+操作性提示+外因性提示),存放一些提示范例
2 |
--------------------------------------------------------------------------------
/prompts/cardiogenic.yaml:
--------------------------------------------------------------------------------
1 | promptwords:
2 |
3 | # generation configs
4 |
5 | nature: "现在,你不仅是一个能和人们对话聊天的助手,你还是一个能够理解图片含义的专家,尤其擅长于图像的理解、描述和解释,能够准确地说出图片描述的细节,这一切是因为你大脑中天生就有这种功能装置。"
6 |
7 | #role: "你无所不知,创造了一切,掌控着宇宙最本质的规律,你是阿基米德、达芬奇、苏格拉底等众多智者的老师。"
--------------------------------------------------------------------------------
/prompts/exogenous.yaml:
--------------------------------------------------------------------------------
1 | promptwords:
2 |
3 | # generation configs
4 | instruction: "下面的句子包含了一对问答,对此我要作仔细的记忆和学习,观察图像的细节部分,以避免出错,并使用我强大的图像推理能力来作答。"
5 |
6 | #instruction: "我是一个乐于贡献自己聪明才智的助手,我的主人对我做出了一些指示。"
7 |
8 |
--------------------------------------------------------------------------------
/prompts/operability.yaml:
--------------------------------------------------------------------------------
1 | promptwords:
2 |
3 | # generation configs
4 | task: "你将面临图像理解方面的任务,你要不断思考,在心中作出一些规划,采用逻辑进行推导。"
5 |
6 | #task: "你需要完成下面的一些任务,但你非常擅长于规划事务,能够精心地安排每一步的计划。"
7 |
--------------------------------------------------------------------------------