初始化项目,由ModelHub XC社区提供模型
Model: cminst/Llama-Nemotron-8B-templatefixes Source: Original Platform
This commit is contained in:
54
.ipynb_checkpoints/chat_template-checkpoint.jinja
Normal file
54
.ipynb_checkpoints/chat_template-checkpoint.jinja
Normal file
@@ -0,0 +1,54 @@
|
||||
{%- if messages[0]['role'] == 'system' -%}
|
||||
{%- set system_message = messages[0]['content'] | trim -%}
|
||||
{%- set messages = messages[1:] -%}
|
||||
{%- else -%}
|
||||
{%- set system_message = '' -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- if tools is not none -%}
|
||||
{{- '<|begin_of_text|><|start_header_id|>system<|end_header_id|>' + '\n\n' + system_message -}}
|
||||
{{- '\n\n' if system_message else '' -}}
|
||||
{{- '<AVAILABLE_TOOLS>[' -}}
|
||||
{% for t in tools %}
|
||||
{{- (t.function if t.function is defined else t) | tojson() -}}
|
||||
{{- ', ' if not loop.last else '' -}}
|
||||
{%- endfor -%}
|
||||
{{- ']</AVAILABLE_TOOLS>' -}}
|
||||
{{- '<|eot_id|>' -}}
|
||||
{%- else -%}
|
||||
{{- '<|begin_of_text|><|start_header_id|>system<|end_header_id|>' + '\n\n' + system_message + '<|eot_id|>' -}}
|
||||
{%- endif -%}
|
||||
|
||||
{%- for message in messages -%}
|
||||
{%- if (message['role'] in ['user', 'tool']) != (loop.index0 % 2 == 0) -%}
|
||||
{{- raise_exception('Conversation roles must alternate between user/tool and assistant') -}}
|
||||
{%- elif message['role'] == 'user' -%}
|
||||
{{- '<|start_header_id|>user<|end_header_id|>' + '\n\n' + message['content'] | trim + '<|eot_id|>' -}}
|
||||
{%- elif message['role'] == 'tool' -%}
|
||||
{%- set tool_response = '<TOOL_RESPONSE>[' + message['content'] | trim + ']</TOOL_RESPONSE>' -%}
|
||||
{{- '<|start_header_id|>user<|end_header_id|>' + '\n\n' + tool_response + '<|eot_id|>' -}}
|
||||
{%- elif message['role'] == 'assistant' and message.get('tool_calls') is not none -%}
|
||||
{%- set tool_calls = message['tool_calls'] -%}
|
||||
{% generation %}
|
||||
{{- '<|start_header_id|>assistant<|end_header_id|>' + '\n\n' + '<TOOLCALL>[' -}}
|
||||
{%- for tool_call in tool_calls -%}
|
||||
{{ '{' + '"name": "' + tool_call.function.name + '", "arguments": ' + tool_call.function.arguments | tojson + '}' }}
|
||||
{%- if not loop.last -%}
|
||||
{{ ', ' }}
|
||||
{%- else -%}
|
||||
{{ ']</TOOLCALL>' + '<|eot_id|>' }}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{% endgeneration %}
|
||||
{%- elif message['role'] == 'assistant' -%}
|
||||
{% generation %}
|
||||
{{- '<|start_header_id|>assistant<|end_header_id|>' + '\n\n' + message['content'] | trim + '<|eot_id|>' -}}
|
||||
{% endgeneration %}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
|
||||
{%- if add_generation_prompt -%}
|
||||
{% generation %}
|
||||
{{ '<|start_header_id|>assistant<|end_header_id|>' + '\n\n' }}
|
||||
{% endgeneration %}
|
||||
{%- endif -%}
|
||||
BIN
.ipynb_checkpoints/tokenizer-checkpoint.json
(Stored with Git LFS)
Normal file
BIN
.ipynb_checkpoints/tokenizer-checkpoint.json
(Stored with Git LFS)
Normal file
Binary file not shown.
2062
.ipynb_checkpoints/tokenizer_config-checkpoint.json
Normal file
2062
.ipynb_checkpoints/tokenizer_config-checkpoint.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user