I'm trying to fine-tune "unsloth/Meta-Llama-3.1-8B-Instruct-bnb-4bit" and serialize it to Ollama. This is my chat format in a file chat_format.txt:
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
{SYSTEM}<|eot_id|><|start_header_id|>user<|end_header_id|>
{INPUT}<|eot_id|><|start_header_id|>assistant<|end_header_id|>
{OUTPUT}<|eot_id|>
Which is copy pasted from the https://colab.research.google.com/drive/1WZDi7APtQ9VsvOrQSSC5DDtxq159j8iZ?usp=sharing#scrollTo=VTzZ5oZrxkFz Ollama example notebook.
This gives me:
RuntimeError: Unsloth: Your prompt template must have 2 examples showing the user input {INPUT} and the assistant output {OUTPUT}
For example what is not allowed is just:
### Input:\n{INPUT}\n\n### Response:\n{OUTPUT}\n
What is required is 2x of this:
### Input:\n{INPUT}\n\n### Response:\n{OUTPUT}\n### Input:\n{INPUT}\n\n### Response:\n{OUTPUT}\n
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/workflow/finetuner.py", line 188, in <module>
fire.Fire(FinetuneModel)
File "/workflow/.venv/lib/python3.11/site-packages/fire/core.py", line 143, in Fire
component_trace = _Fire(component, args, parsed_flag_args, context, name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workflow/.venv/lib/python3.11/site-packages/fire/core.py", line 477, in _Fire
component, remaining_args = _CallAndUpdateTrace(
^^^^^^^^^^^^^^^^^^^^
File "/workflow/.venv/lib/python3.11/site-packages/fire/core.py", line 693, in _CallAndUpdateTrace
component = fn(*varargs, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^
File "/workflow/finetuner.py", line 39, in __init__
self.load_dataset()
File "/workflow/finetuner.py", line 96, in load_dataset
self.dataset[key] = apply_chat_template(
So apparently the example for llama is wrong.