-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Josh
committed
Jun 10, 2024
1 parent
b8e4f37
commit 3186bd7
Showing
12 changed files
with
172 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{{ (messages|selectattr('role', 'equalto', 'system')|list|last).content|trim if (messages|selectattr('role', 'equalto', 'system')|list) else '' }} | ||
|
||
{% for message in messages %} | ||
{% if message['role'] == 'user' %} | ||
### Instruction: | ||
{{ message['content']|trim -}} | ||
{% if not loop.last %} | ||
|
||
|
||
{% endif %} | ||
{% elif message['role'] == 'assistant' %} | ||
### Response: | ||
{{ message['content']|trim -}} | ||
{% if not loop.last %} | ||
|
||
|
||
{% endif %} | ||
{% elif message['role'] == 'user_context' %} | ||
### Input: | ||
{{ message['content']|trim -}} | ||
{% if not loop.last %} | ||
|
||
|
||
{% endif %} | ||
{% endif %} | ||
{% endfor %} | ||
{% if add_generation_prompt and messages[-1]['role'] != 'assistant' %} | ||
### Response: | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{%- set counter = namespace(index=0) -%} | ||
{%- for message in messages -%} | ||
{%- if message['role'] == 'user' -%} | ||
{{- '[Round ' + counter.index|string + ']\n问:' + message['content'] -}} | ||
{%- set counter.index = counter.index + 1 -%} | ||
{%- endif -%} | ||
{%- if message['role'] == 'assistant' -%} | ||
{{- '\n答:' + message['content'] -}} | ||
{%- if (loop.last and add_generation_prompt) or not loop.last -%} | ||
{{- '\n' -}} | ||
{%- endif -%} | ||
{%- endif -%} | ||
{%- endfor -%} | ||
|
||
|
||
{%- if add_generation_prompt and messages[-1]['role'] != 'assistant' -%} | ||
{{- '\n答:' -}} | ||
{%- endif -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{%- set counter = namespace(index=1) -%} | ||
{%- for message in messages -%} | ||
{%- if message['role'] == 'user' -%} | ||
{{- '[Round ' + counter.index|string + ']\n\n问:' + message['content'] -}} | ||
{%- set counter.index = counter.index + 1 -%} | ||
{%- endif -%} | ||
{%- if message['role'] == 'assistant' -%} | ||
{{- '\n\n答:' + message['content'] -}} | ||
{%- if (loop.last and add_generation_prompt) or not loop.last -%} | ||
{{- '\n\n' -}} | ||
{%- endif -%} | ||
{%- endif -%} | ||
{%- endfor -%} | ||
|
||
|
||
{%- if add_generation_prompt and messages[-1]['role'] != 'assistant' -%} | ||
{{- '\n\n答:' -}} | ||
{%- endif -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content']}}{% if (loop.last and add_generation_prompt) or not loop.last %}{{ '<|im_end|>' + '\n'}}{% endif %}{% endfor %} | ||
{% if add_generation_prompt and messages[-1]['role'] != 'assistant' %}{{ '<|im_start|>assistant\n' }}{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{%- for message in messages -%} | ||
{%- if message['role'] == 'system' -%} | ||
{{- 'System: ' + message['content'] -}} | ||
{%- elif message['role'] == 'user' -%} | ||
{{- 'User: ' + message['content'] -}} | ||
{%- elif message['role'] == 'assistant' -%} | ||
{{- 'Falcon: ' + message['content'] -}} | ||
{%- endif -%} | ||
{%- if (loop.last and add_generation_prompt) or not loop.last -%} | ||
{{- '\n' -}} | ||
{%- endif -%} | ||
{%- endfor -%} | ||
|
||
|
||
{%- if add_generation_prompt and messages[-1]['role'] != 'assistant' -%} | ||
{{- 'Falcon:' -}} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{%- for message in messages -%} | ||
{%- if message['role'] == 'user' -%} | ||
{{- 'User: ' + message['content'] -}} | ||
{%- elif message['role'] == 'assistant' -%} | ||
{{- 'Assistant: ' + message['content'] -}} | ||
{%- endif -%} | ||
{%- if (loop.last and add_generation_prompt) or not loop.last -%} | ||
{{- '\n' -}} | ||
{%- endif -%} | ||
{%- endfor -%} | ||
|
||
|
||
{%- if add_generation_prompt and messages[-1]['role'] != 'assistant' -%} | ||
{{- 'Assistant:' -}} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{% if messages[0]['role'] == 'system' %} | ||
{% set system_message = '<<SYS>>\n' + messages[0]['content'] | trim + '\n<</SYS>>\n\n' %} | ||
{% set messages = messages[1:] %} | ||
{% else %} | ||
{% set system_message = '' %} | ||
{% endif %} | ||
|
||
{% for message in messages %} | ||
{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %} | ||
{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }} | ||
{% endif %} | ||
|
||
{% if loop.index0 == 0 %} | ||
{% set content = system_message + message['content'] %} | ||
{% else %} | ||
{% set content = message['content'] %} | ||
{% endif %} | ||
|
||
{% if message['role'] == 'user' %} | ||
{{ bos_token + '[INST] ' + content | trim + ' [/INST]' }} | ||
{% elif message['role'] == 'assistant' %} | ||
{{ ' ' + content | trim + ' ' + eos_token }} | ||
{% endif %} | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{% if messages[0]['role'] == 'system' %} | ||
{% set offset = 1 %} | ||
{% else %} | ||
{% set offset = 0 %} | ||
{% endif %} | ||
|
||
{{ bos_token }} | ||
{% for message in messages %} | ||
{% if (message['role'] == 'user') != (loop.index0 % 2 == offset) %} | ||
{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }} | ||
{% endif %} | ||
|
||
{{ '<|start_header_id|>' + message['role'] + '<|end_header_id|>\n\n' + message['content'] | trim + '<|eot_id|>' }} | ||
{% endfor %} | ||
|
||
{% if add_generation_prompt %} | ||
{{ '<|start_header_id|>' + 'assistant' + '<|end_header_id|>\n\n' }} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{%- if messages[0]['role'] == 'system' -%} | ||
{%- set system_message = messages[0]['content'] -%} | ||
{%- set messages = messages[1:] -%} | ||
{%- else -%} | ||
{% set system_message = '' -%} | ||
{%- endif -%} | ||
|
||
{{ bos_token + system_message }} | ||
{%- for message in messages -%} | ||
{%- if (message['role'] == 'user') != (loop.index0 % 2 == 0) -%} | ||
{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }} | ||
{%- endif -%} | ||
|
||
{%- if message['role'] == 'user' -%} | ||
{{ 'USER: ' + message['content'] + '\n' }} | ||
{%- elif message['role'] == 'assistant' -%} | ||
{{ 'ASSISTANT: ' + message['content'] + eos_token + '\n' }} | ||
{%- endif -%} | ||
{%- endfor -%} | ||
|
||
{%- if add_generation_prompt -%} | ||
{{ 'ASSISTANT:' }} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
vllm==0.4.2 | ||
vllm==0.4.3 | ||
hf_transfer | ||
accelerate |