Text-to-Image
Transformers
Safetensors
xiaoyu1104 commited on
Commit
8eb38fc
·
verified ·
1 Parent(s): 691d8a4

Upload Sa2va-Instance-4B/templates.py

Browse files
Files changed (1) hide show
  1. Sa2va-Instance-4B/templates.py +170 -0
Sa2va-Instance-4B/templates.py ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ PROMPT_TEMPLATE = dict(
3
+ default=dict(
4
+ SYSTEM='<|System|>:{system}\n',
5
+ INSTRUCTION='<|User|>:{input}\n<|Bot|>:',
6
+ SEP='\n'),
7
+ zephyr=dict(
8
+ SYSTEM='<|system|>\n{system}\n',
9
+ INSTRUCTION='<|user|>\n{input}\n<|assistant|>\n',
10
+ SEP='\n'),
11
+ internlm_chat=dict(
12
+ SYSTEM='<|System|>:{system}\n',
13
+ INSTRUCTION='<|User|>:{input}<eoh>\n<|Bot|>:',
14
+ SUFFIX='<eoa>',
15
+ SUFFIX_AS_EOS=True,
16
+ SEP='\n',
17
+ STOP_WORDS=['<eoa>']),
18
+ internlm2_chat=dict(
19
+ SYSTEM='<|im_start|>system\n{system}<|im_end|>\n',
20
+ INSTRUCTION=('<|im_start|>user\n{input}<|im_end|>\n'
21
+ '<|im_start|>assistant\n'),
22
+ SUFFIX='<|im_end|>',
23
+ SUFFIX_AS_EOS=True,
24
+ SEP='\n',
25
+ STOP_WORDS=['<|im_end|>']),
26
+ moss_sft=dict(
27
+ SYSTEM='{system}\n',
28
+ INSTRUCTION='<|Human|>: {input}<eoh>\n',
29
+ SEP='\n',
30
+ STOP_WORDS=['<eoc>', '<eom>']),
31
+ llama2_chat=dict(
32
+ SYSTEM=(
33
+ '[INST] <<SYS>>\n You are a helpful, respectful and honest '
34
+ 'assistant. Always answer as helpfully as possible, while being '
35
+ 'safe. Your answers should not include any harmful, unethical, '
36
+ 'racist, sexist, toxic, dangerous, or illegal content. Please '
37
+ 'ensure that your responses are socially unbiased and positive in '
38
+ 'nature.\n{system}\n<</SYS>>\n [/INST] '),
39
+ INSTRUCTION='[INST] {input} [/INST]',
40
+ SEP='\n'),
41
+ code_llama_chat=dict(
42
+ SYSTEM='{system}\n', INSTRUCTION='[INST] {input} [/INST]'),
43
+ chatglm2=dict(
44
+ SYSTEM='{system}\n',
45
+ INSTRUCTION='[Round {round}]\n\n问:{input}\n\n答:',
46
+ SEP='\n\n'),
47
+ chatglm3=dict(
48
+ SYSTEM='<|system|>\n{system}',
49
+ INSTRUCTION='<|user|>\n{input}<|assistant|>\n',
50
+ SEP='\n'),
51
+ qwen_chat=dict(
52
+ SYSTEM=('<|im_start|>system\n{system}<|im_end|>\n'),
53
+ INSTRUCTION=('<|im_start|>user\n{input}<|im_end|>\n'
54
+ '<|im_start|>assistant\n'),
55
+ SUFFIX='<|im_end|>',
56
+ SUFFIX_AS_EOS=True,
57
+ SEP='\n',
58
+ STOP_WORDS=['<|im_end|>', '<|endoftext|>']),
59
+ baichuan_chat=dict(
60
+ SYSTEM='{system}\n',
61
+ INSTRUCTION='<reserved_102>{input}<reserved_103>',
62
+ SEP='\n'),
63
+ baichuan2_chat=dict(
64
+ SYSTEM='{system}\n',
65
+ INSTRUCTION='<reserved_106>{input}<reserved_107>',
66
+ SEP='\n'),
67
+ wizardlm=dict(
68
+ SYSTEM=('A chat between a curious user and an artificial '
69
+ 'intelligence assistant. The assistant gives '
70
+ 'helpful, detailed, and polite answers to the '
71
+ 'user\'s questions. {system}\n '),
72
+ INSTRUCTION=('USER: {input} ASSISTANT:'),
73
+ SEP='\n'),
74
+ wizardcoder=dict(
75
+ SYSTEM=(
76
+ 'Below is an instruction that describes a task. '
77
+ 'Write a response that appropriately completes the request.\n\n'
78
+ '{system}\n '),
79
+ INSTRUCTION=('### Instruction:\n{input}\n\n### Response:'),
80
+ SEP='\n\n'),
81
+ vicuna=dict(
82
+ SYSTEM=('A chat between a curious user and an artificial '
83
+ 'intelligence assistant. The assistant gives '
84
+ 'helpful, detailed, and polite answers to the '
85
+ 'user\'s questions. {system}\n '),
86
+ INSTRUCTION=('USER: {input} ASSISTANT:'),
87
+ SEP='\n'),
88
+ deepseek_coder=dict(
89
+ SYSTEM=('You are an AI programming assistant, utilizing '
90
+ 'the DeepSeek Coder model, developed by DeepSeek'
91
+ 'Company, and you only answer questions related '
92
+ 'to computer science. For politically sensitive '
93
+ 'questions, security and privacy issues, and '
94
+ 'other non-computer science questions, you will '
95
+ 'refuse to answer. {system}\n'),
96
+ INSTRUCTION=('### Instruction:\n{input}\n### Response:\n'),
97
+ SEP='\n'),
98
+ # TODO: deprecation, v0.2.0
99
+ deepseekcoder=dict(
100
+ SYSTEM=('You are an AI programming assistant, utilizing '
101
+ 'the DeepSeek Coder model, developed by DeepSeek'
102
+ 'Company, and you only answer questions related '
103
+ 'to computer science. For politically sensitive '
104
+ 'questions, security and privacy issues, and '
105
+ 'other non-computer science questions, you will '
106
+ 'refuse to answer. {system}\n'),
107
+ INSTRUCTION=('### Instruction:\n{input}\n### Response:\n'),
108
+ SEP='\n'),
109
+ deepseek_moe=dict(
110
+ SYSTEM=('[INST] {system} [/INST]\n'),
111
+ INSTRUCTION=('[INST] {input} [/INST]'),
112
+ SEP='\n'),
113
+ deepseek_v2=dict(
114
+ SYSTEM='{system}\n\n',
115
+ INSTRUCTION='User: {input}\n\nAssistant: ',
116
+ SUFFIX='<|end▁of▁sentence|>',
117
+ SUFFIX_AS_EOS=True,
118
+ STOP_WORDS=['<|end▁of▁sentence|>']),
119
+ mistral=dict(
120
+ SYSTEM=('[INST] {system} [/INST]\n'),
121
+ INSTRUCTION=('[INST] {input} [/INST]'),
122
+ SEP='\n'),
123
+ mixtral=dict(
124
+ SYSTEM=('[INST] {system} [/INST]\n'),
125
+ INSTRUCTION=('[INST] {input} [/INST]'),
126
+ SEP='\n'),
127
+ minicpm=dict(INSTRUCTION=('<用户> {input} <AI>'), SEP='\n'),
128
+ minicpm3=dict(
129
+ SYSTEM=('<|im_start|>system\n{system}<|im_end|>\n'),
130
+ INSTRUCTION=('<|im_start|>user\n{input}<|im_end|>\n'
131
+ '<|im_start|>assistant\n'),
132
+ SUFFIX='<|im_end|>',
133
+ SUFFIX_AS_EOS=True,
134
+ SEP='\n',
135
+ STOP_WORDS=['<|im_end|>', '<|endoftext|>']),
136
+ gemma=dict(
137
+ # `system` field is extended by xtuner
138
+ SYSTEM=('<start_of_turn>system\n{system}<end_of_turn>\n'),
139
+ INSTRUCTION=('<start_of_turn>user\n{input}<end_of_turn>\n'
140
+ '<start_of_turn>model\n'),
141
+ SUFFIX='<end_of_turn>',
142
+ SUFFIX_AS_EOS=False,
143
+ SEP='\n',
144
+ STOP_WORDS=['<end_of_turn>']),
145
+ cohere_chat=dict(
146
+ SYSTEM=('<|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>{system}'
147
+ '<|END_OF_TURN_TOKEN|>'),
148
+ INSTRUCTION=(
149
+ '<|START_OF_TURN_TOKEN|><|USER_TOKEN|>{input}<|END_OF_TURN_TOKEN|>'
150
+ '<|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>'),
151
+ SUFFIX='<|END_OF_TURN_TOKEN|>',
152
+ SUFFIX_AS_EOS=True,
153
+ STOP_WORDS=['<|END_OF_TURN_TOKEN|>']),
154
+ llama3_chat=dict(
155
+ SYSTEM=('<|start_header_id|>system<|end_header_id|>\n\n'
156
+ '{system}<|eot_id|>'),
157
+ INSTRUCTION=(
158
+ '<|start_header_id|>user<|end_header_id|>\n\n{input}<|eot_id|>'
159
+ '<|start_header_id|>assistant<|end_header_id|>\n\n'),
160
+ SUFFIX='<|eot_id|>',
161
+ SUFFIX_AS_EOS=True,
162
+ STOP_WORDS=['<|eot_id|>']),
163
+ phi3_chat=dict(
164
+ SYSTEM='<|system|>\n{system}<|end|>\n',
165
+ INSTRUCTION='<|user|>\n{input}<|end|>\n<|assistant|>\n',
166
+ SUFFIX='<|end|>',
167
+ SUFFIX_AS_EOS=True,
168
+ SEP='\n',
169
+ STOP_WORDS=['<|end|>']),
170
+ )