Fine-tuning Llama 2 for Tone or Style

preview_player
Показать описание
Fine-tune Llama 2 (or any huggingface model!) for tone or style using a custom dataset - here, Shakespeare!

*Free Resources*

1. Create Embeddings with OpenAI, marco, or Llama 2.
2. Run inference with injected embeddings

- Run fine-tuning using a Q&A dataset.

*Fine-tuning Repository Access*
1. Supervised Fine-tuning Notebook
2. Q&A Dataset Preparation Scripts
3. Embedding Notebook (Scripts to create and use Embeddings)
4. Notebook to fine-tune for Tone or Style
5. Forum Support

Chapters:
0:00 How to fine tune on a custom dataset
0:15 What dataset should I use for fine-tuning?
0:50 Fine-tuning in Google Colab
2:45 Loading Llama 2 with bitsandbytes
3:15 Fine-tuning with LoRA
3:50 Target modules for fine-tuning
4:15 Loading data for fine-tuning
5:30 Training Llama 2 with a validation set
6:30 Setting training parameters for fine-tuning
7:50 Choosing batch size for training
8:15 Setting gradient accumulation for training
9:25 Using an eval dataset for training
9:50 Setting warm-up parameters for training
10:50 Using AdamW for optimisation
13:20 Fix for when commands don't work in Colab
15:00 Evaluating training loss
16:20 Running inference after training
Рекомендации по теме
Комментарии
Автор

Thanks for the great tutorial. I am wondering if I can also build a model which converts an input sentence into a specific style, using Supervised or Instruction-based finetuning methods.

mark-pwxf
Автор

Tnank you, Trelis! It's great tutorial!

AnnaKholkina
Автор

Thank you, sir. Your channel is awesome. Just a quick question, can I use SFTTrainer using the dataset_text_field="text" and tokenizer=tokenizer and avoid to do the data.map(lambda samples: tokenizer(samples["text"]), batched=True) thing?

xdrap
Автор

I'm trying to create 100 000 reliable tutorials for hundred complex software like photoshop, blender, da vinci resolve etc.. Llama and gpt don't give reliable answer unfortunately. Do you think finetuning llama 7b would be enough (compared to 70b)? Do you know how much time/data that would take?
I also heard about embedding but couldn't get it to work on large dataset. Would that be a better option? We have at least 40 000 pages of documentation I don't know what the better approach is.

finnsteur
Автор

can you make a video on how to teach a llama another language? I want to make a translator

omaribrahim