-
GenAI – Instruction Tuning.
GenAI – Instruction Tuning. Table Of Contents: What Is Instruction Tuning? Steps Involved In Instruction Tuning. Example Of Instruction Tuning. Instruction Tuning Vs Few Shot Prompting. (1) What Is Instruction Tuning ? (2) How Instruction Tuning Helps ? (2) Steps Involved In Instruction Tuning . (2) Example Of Instruction Tuning ? Step-1: Install Required Libraries pip install transformers datasets peft accelerate bitsandbytes Step-2: Sample Instruction Dataset We’ll use a few inline samples. In real cases, use a larger dataset like Alpaca, FLAN, or Self-Instruct. from datasets import Dataset # Sample toy dataset with instruction-style tasks data = [ { "instruction":
-
GenAI – Prompt Tuning .
-
GenAI – Prefix Tuning .
-
GenAI – IA³ Adapters Tuning .
-

GenAI – Bottleneck Adapters Tuning .
-

GenAI – What Is Hugging Face PEFT ?
GenAI – What Is Hugging Face PEFT ? Table Of Contents: What Is Hugging Face PEFT ? What Is PEFT ? Features of Hugging Face PEFT . Example: Using LoRA via Hugging Face PEFT Supported Techniques in PEFT Library (1) What Is Hugging Face PEFT ? (2) What Is PEFT ? (3) Features Of Hugging Face PEFT . (4) Example: Using LoRA via Hugging Face PEFT from transformers import AutoModelForCausalLM, AutoTokenizer from peft import get_peft_model, LoraConfig, TaskType model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-2-7b-hf") tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-2-7b-hf") # Define LoRA configuration lora_config = LoraConfig( r=8, lora_alpha=16, target_modules=["q_proj", "v_proj"], lora_dropout=0.05, task_type=TaskType.CAUSAL_LM ) # Apply PEFT
-

GenAI – Adapters In LLM.
GenAI – What Is Adapters In LLM ? Table Of Contents: What Is An Adapter ? Why To Use Adapters ? How Adapters Works ? Why Use Adapters ? (1) What Is An Adapter ? (2) Why To Use Adapter ? (3) How Adapter Works ? (4) Why Use Adapters ? (5) List Of Adapters Available ? (6) List Of Adapters Methods Available ? Bottleneck Adapters. Language Adapters – Invertible Adapters. Prefix Tuning. Compacter. LoRA. IA3. Vera. Prompt Tuning. ReFT. (7) Example with Hugging Face’s PEFT (LoRA Adapters) from transformers import AutoModelForCausalLM from peft import get_peft_model, LoraConfig model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-2-7b-hf")
-

GenAI – What Is QLoRA Fine Tuning ?
GenAI – What Is QLoRA Fine Tuning ? Table Of Contents: What Is Quantization Process ? What Is QLoRA ? Benefits Of QLoRA. Example Of QLoRA. (1) What Is Quantization Process ? (2) What Is QLoRA ? (3) Benefits Of QLoRA ? (4) Example Of QLoRA . transformers peft bitsandbytes datasets from transformers import AutoModelForCausalLM, AutoTokenizer, TrainingArguments, Trainer from peft import prepare_model_for_kbit_training, get_peft_model, LoraConfig, TaskType from datasets import load_dataset from transformers import DataCollatorForLanguageModeling # Load 4-bit quantized model model_name = "meta-llama/Llama-2-7b-hf" model = AutoModelForCausalLM.from_pretrained( model_name, load_in_4bit=True, device_map="auto" ) # Load tokenizer tokenizer = AutoTokenizer.from_pretrained(model_name) # Prepare for QLoRA training model
-

GenAI – What Is LoRA Fine Tuning ?
GenAI – What Is Full LoRA Fine Tuning ? Table Of Contents: What Is LoRA Fine-Tuning? Why Use LoRA? How LoRA Works (Basic Concept) Example Use Case: Fine-Tuning LLaMA-2 7B with LoRA ? When to Use LoRA ? When NOT to Use LoRA ? Summary . (1) What Is Low Rank Adaption (LoRA) Technique ? (2) What Is Happening Inside LoRA ? (3) Why To Use LoRA ? (4) When To Use LoRA ? (5) When Not to Use LoRA ? (6) Example Use Case: Fine-Tuning LLaMA-2 7B with LoRA ? pip install transformers datasets peft accelerate bitsandbytes from transformers
-

GenAI – Full Fine-Tuning LLM Models.
GenAI – What Is Full Fine Tuning LLM Models ? Table Of Contents: What Is Full Fine-Tuning of LLMs? How Full Fine-Tuning Works (Simple Steps) When To Use Full Fine Tuning LLM Models ? Advantages of Full Fine-Tuning Disadvantages of Full Fine-Tuning (1) What Is Full Fine-Tuning LLM Models ? (2) How Full Fine-Tuning Works (Simple Steps) (3) When To Use Full Fine Tuning LLM Models ? (4) Advantages of Full Fine-Tuning (5) Advantages of Full Fine-Tuning
