davanstrien HF Staff commited on
Commit
44bb02a
·
verified ·
1 Parent(s): 7f78323

Upload model trained with Unsloth

Browse files

Upload model trained with Unsloth 2x faster

Files changed (1) hide show
  1. tokenizer_config.json +2 -3
tokenizer_config.json CHANGED
@@ -296,6 +296,5 @@
296
  "normalized": false,
297
  "special": true
298
  }
299
- },
300
- "chat_template": "{%- if not messages %}\n {{- raise_exception('No messages provided.') }}\n{%- endif %}\n{%- set image_count = namespace(value=0) %}\n{%- set image_placeholder = '<|vision_start|><|image_pad|><|vision_end|>' -%}\n{%- set mode = mode | default('content') -%}\n{%- if template -%}{%- set mode = 'structured' -%}{%- endif -%}\n{%- if not template and mode == 'structured' %}\n {{- raise_exception('`structured` mode specified but no `template` provided.') }}\n{%- endif %}\n{%- if mode not in ['structured', 'content', 'template-generation', 'document-detection', 'markdown'] -%}{%- set mode = 'content' -%}{%- endif -%}\n{%- if mode == 'markdown' %}{%- set mode = 'content' -%}{%- endif %}\n{%- set enable_thinking = enable_thinking | default(False) -%}\n{%- if mode not in ['structured', 'content'] and enable_thinking %}\n {{- raise_exception('`enable_thinking` can only be `True` for `structured` and `content` modes.') }}\n{%- endif %}\n{%- set has_examples = namespace(flag=false) -%}\n{%- if mode != 'structured' -%}{%- set has_examples = false -%}{%- endif -%}\n{# MACRO TO RENDER MESSAGE CONTENT #}\n{%- macro render_content(content, do_vision_count, is_system_content=false) %}\n {%- if content is string %}\n {{- content }}\n {%- elif content is iterable and content is not mapping %}\n {%- for item in content %}\n {%- if 'image' in item or 'image_url' in item or item.type == 'image' %}\n {%- if is_system_content %}\n {{- raise_exception('System message cannot contain images.') }}\n {%- endif %}\n {%- if do_vision_count %}\n {%- set image_count.value = image_count.value + 1 %}\n {%- endif %}\n {%- if add_vision_id %}\n {{- 'Picture ' ~ image_count.value ~ ': ' }}\n {%- endif %}\n {{- '<|vision_start|><|image_pad|><|vision_end|>\\n' }}\n {%- elif 'text' in item %}\n {{- item.text + '\\n' }}\n {%- else %}\n {{- raise_exception('Unexpected item type in content.') }}\n {%- endif %}\n {%- endfor %}\n {%- elif content is none or content is undefined %}\n {{- '' }}\n {%- else %}\n {{- raise_exception('Unexpected content type.') }}\n {%- endif %}\n{%- endmacro %}\n{# SYSTEM MESSAGE #}\n{%- if messages[0].role == 'system' %}\n {%- set content = render_content(messages[0].content, false, true)|trim %}\n {{- '<|im_start|>system\\n' + content + '<|im_end|>\\n' }}\n{%- endif %}\n{# USER MESSAGE #}\n{{- '<|im_start|>user\\n' -}}\n{{- '【task】' + mode|replace(\"-\", \" \") + '\\n' -}}\n{# Template Section (for structured task): specifies template, instructions, examples, previous_output #}\n{%- if mode == 'structured' -%}\n {{- '【template_start】' + template + '【template_end】\\n' -}}\n {# Instructions Section #}\n {%- if instructions -%}\n {{- '【instructions_start】' + instructions + '【instructions_end】\\n'-}}\n {%- endif -%}\n {# Examples Section (only for extraction tasks) #}\n {%- for message in messages -%}\n {%- if message.role == 'developer' and 'content' in message -%}\n {# Validate that there is at least one input and one output contents #}\n {%- set example_inputs = message.content[:-1] -%}\n {%- set example_output_part = message.content[-1] -%}\n {%- if example_inputs|length > 0 -%}\n {%- if not has_examples.flag -%}\n {{- '【examples_start】\\n' -}}\n {%- set has_examples.flag = true -%}\n {%- endif -%}\n {{- '【example_input_start】' + render_content(example_inputs, true)|trim + '【example_input_end】\\n' -}}\n {# Example output: only keep the text of the first output content #}\n {%- set output_text = '' -%}\n {%- if example_output_part is string -%}\n {%- set output_text = example_output_part -%}\n {%- elif example_output_part.text is defined -%}\n {%- set output_text = example_output_part.text -%}\n {%- endif -%}\n {{- '【example_output_start】' + output_text|trim + '【example_output_end】\\n' -}}\n {%- if loop.last and has_examples.flag -%}\n {{- '【examples_end】\\n' -}}\n {%- endif -%}\n {%- endif -%}\n {%- endif -%}\n {%- endfor -%}\n {# Previous Output Section #}\n {%- if previous_output -%}\n {{- '【previous_output_start】' + previous_output + '【previous_output_end】\\n' -}}\n {%- endif -%}\n{%- endif -%}\n{{- '【document_start】\\n' -}}\n{# PROCESS PROVIDED USER MESSAGES (RENDERED INTO A SINGLE ONE) #}\n{%- for message in messages -%}\n {%- if message.role == \"system\" %}\n {%- if not loop.first %}\n {{- raise_exception('System message must be at the beginning.') }}\n {%- endif %}\n {%- elif message.role == 'user' and message.name != \"example\" -%}\n {%- set content = render_content(message.content, true)|trim %}\n {{- content + '\\n' -}}\n {# {%- elif message.role == 'assistant' and not loop.last %}\n llama.cpp renders a synthetic init example with an assistant turn in\n the middle; ignore it so valid NuExtract prompts render unchanged.\n {{- raise_exception('Assistant message must be at the end.') }} #}\n {%- endif %}\n{%- endfor -%}\n{{- '【document_end】<|im_end|>\\n' -}}\n{# ASSISTANT MESSAGE #}\n{%- if messages[-1].role == 'assistant' %}\n {%- if add_generation_prompt -%}\n {{- raise_exception('`add_generation_prompt` can only be `True` when no assistant message is provided.') }}\n {%- endif %}\n {%- set content = render_content(messages[-1].content, true)|trim %}\n {%- set reasoning_content = '' %}\n {%- if messages[-1].reasoning_content is string %}\n {%- set reasoning_content = messages[-1].reasoning_content %}\n {%- else %}\n {%- if '</think>' in content %}\n {%- set reasoning_content = content.split('</think>')[0].rstrip('\\n').split('<think>')[-1].lstrip('\\n') %}\n {%- set content = content.split('</think>')[-1].lstrip('\\n') %}\n {%- endif %}\n {%- endif %}\n {%- set reasoning_content = reasoning_content|trim %}\n {% generation %}\n {{- '<|im_start|>assistant\\n<think>\\n' + reasoning_content + '\\n</think>\\n\\n' + content + '<|im_end|>\\n' -}}\n {% endgeneration %}\n{%- endif -%}\n{# GENERATION PROMPT #}\n{%- if add_generation_prompt -%}\n {{- '<|im_start|>assistant\\n' -}}\n {%- if not enable_thinking -%}\n {{- '<think>\\n\\n</think>\\n\\n' -}}\n {%- else %}\n {{- '<think>\\n' -}}\n {%- endif %}\n{%- endif -%}\n"
301
- }
 
296
  "normalized": false,
297
  "special": true
298
  }
299
+ }
300
+ }