Goal: Get hands-on proof of how chat templates convert {role, content} messages into model-ready strings, see why templates differ across model families, and practice preprocessing a real dataset with apply_chat_template() as you would before fine-tuning. Steps:
transformers, datasets, and trl.meta-llama/Meta-Llama-3-8B-Instruct) with AutoTokenizer.from_pretrained(...). (If a gated repo blocks you, use any publicly available Llama-3-family tokenizer or substitute a comparable open tokenizer — the point is the template, not the specific weights, and you never need to download the full model to inspect its tokenizer.){"role": ..., "content": ...} message dicts representing a short conversation (system + user + assistant turns).tokenizer.apply_chat_template(messages, tokenize=False) and print the raw output string. Annotate in your notebook (as markdown comments) where the turn boundaries and special tokens appear.databricks/databricks-dolly-15k dataset from the Hugging Face Hub. Take one raw example and manually rewrite it as a chat-style message list (system/user/assistant, using the Dolly instruction, context, and response fields)..select(range(200)), is fine for compute reasons) using .map() to convert each row into a message list and apply the Llama-3 tokenizer's apply_chat_template() with tokenize=True.Deliverables: Submit your Colab notebook (.ipynb, shared link or file upload) containing all code cells with output visible, your side-by-side template comparison writeup, and your tokenized-length statistics, plus a 150–250 word reflection on what would happen if you fed the Qwen-formatted string into the Llama-3 tokenizer's training pipeline by mistake.