-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.py
36 lines (32 loc) · 914 Bytes
/
test.py
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
from chatformat import format_chat_prompt
example_chat = [
{'role': 'system', 'content': 'You are a very clever LLM.'},
{'role': 'user', 'content': 'Hello?'},
{'role': 'assistant', 'content': 'Hello.'},
{'role': 'user', 'content': 'What are you thinking?'},
{'role': 'assistant', 'content': 'I think that'},
]
example_custom_template = {
'with_system': (
'>system: {system}\n'
'>user: {user}\n'
'>assistant: {assistant}'
'</s>'
),
'without_system': (
'>user: {user}\n'
'>assistant: {assistant}'
'</s>'
),
'round_seperator': '\n'
}
for template in ('llama-2', 'vicuna', 'alpaca', 'chatml', 'human-response', example_custom_template):
prompt, _ = format_chat_prompt(
template=template,
messages=example_chat
)
print((template if type(template) == str else 'custom').ljust(20, '-'))
print(prompt)
print('--------------------')
print()
print()