unslothai / unsloth

Finetune Llama 3.2, Mistral, Phi & Gemma LLMs 2-5x faster with 80% less memory
https://unsloth.ai
Apache License 2.0
17.48k stars 1.21k forks source link

only instruct model can use Llama-3 prompt format #873

Open liwd190019 opened 2 months ago

liwd190019 commented 2 months ago

From the one of the unsloth notebook, there's one piece:

Use below if you want to use the Llama-3 prompt format. You must use the instruct and not the base model if you use this!

chat_template = """<|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|>"""

My question is why we can't use base model for this chat_template? Thanks in advance!

danielhanchen commented 2 months ago

Oh it's because the base model has untrained tokens - see https://unsloth.ai/blog/phi3 (Phi-3 blog has Llama-3 fixes). We identified this issue about using the Llama-3 chat template for the base model