From 239e811bc71f4efa0789dee9b8d6cecb3f60b614 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Mon, 14 Oct 2024 01:11:15 -0700 Subject: [PATCH] Updated Home (markdown) --- Home.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Home.md b/Home.md index 1a8801b..ef015c5 100644 --- a/Home.md +++ b/Home.md @@ -263,6 +263,16 @@ tokenizer = get_chat_template( ) ``` +### Adding new tokens +Unsloth has a function called `add_new_tokens` which allows you to add new tokens to your finetune. For example if you want to add ``, `` and `` we can do the following: +```python +model, tokenizer = FastLanguageModel.from_pretrained(...) +from unsloth import add_new_tokens +add_new_tokens(model, tokenizer, new_tokens = ["", "", ""]) +model = FastLanguageModel.get_peft_model(...) +``` +Note - you MUST always call `add_new_tokens` before `FastLanguageModel.get_peft_model`! + ### 2x Faster Inference Unsloth supports natively 2x faster inference. All QLoRA, LoRA and non LoRA inference paths are 2x faster. This requires no change of code or any new dependencies. ```python