Fine Tune Llama 3 using ORPO

AI Anytime · Beginner ·🧠 Large Language Models ·2y ago

Key Takeaways

Fine-tuning Llama 3 using Odds Ratio Preference Optimization (ORPO) technique, which aligns LLMs with specific ethical standards and preferences, and utilizes tools like Transformers, PyTorch, and Weights and Biases for efficient training.

Full Transcript

hello everyone welcome to AI anytime channel in this video we going to find tune Lama 3 Lama 3 is the newest llm by meta AI in the coming weeks guys they're again going to release a multimodal llm as well so stay tuned for that now meta AI has released llama 3 train on 15 trilon tokens Lama 2 was train on two trilon So it's 15 more 7x even more than 7x right so imagine the I millions of dollars have been spent on llama 3 why open source Community guys Facebook has tons of data like meta AI has tons of data from their Facebook Instagram whatever and they can leverage all these data you know to train these kind of llms of course there are public data available redit Wikipedia and blah blah blah now meta has released Lama 3 everybody is using it performing really well on the leaderboard have you know fantastic reasoning capabilities as people have said it but how can you fine tune it that's the question now there are different ways of fine tuning an llm even on my channel I have 20 plus videos on fine tuning llms in this video we're going to focus on Oro odds ratio preference optimization it's a very fairly new technique you know to find tune an llm for Downstream tasks or basically Alig an llm that might be the right word I already have a video on orpo let's jump into orpo and see how we can I'm already fine-tuning it I'm not going to write a lot of code guys because the codes are going to be pretty standard we're going to take some code from previous videos and whatever we have and the code is available even Maxim has created a notebook the creator of merge kit and when I can share his notebook and go through the link but I'll just show you that I'm right now while creating this video I'm fine-tuning it for few steps just to trying it out let me show you what I am doing in this video now first go into it but if you want to understand orpo you should watch this video of mine which says orpo explained Superior llm Alignment technique versus DPO and rlf okay so basically orpo eliminates a need of a reference model that's a separate separate model for example if you go with a DPO direct performance optimization then you might need a reference model in that case first you find tune using sft the base model you will take it find tun using sft and then again you will use a reference model that becomes a bit of you know I mean that not at all costly when you compare this with r but at the same time it's complex because you need a separate model so there are different alignments techniques Chad GPT were based on uh rlf open AI has hir a lot of human annotators in Africa somewhere in Kenya Ghana I forgot the exact country but they hired some annotators they annotated the data you know reject reward whatever so rlf is extremely costly don't go into the bandwagon of saying that even you can do rlf you can't I mean you need a lot of money to do that not of you know good quality data to do that so rlf is costly so let's eliminate that from the equation then we have DPO PPO you know and different techniques that you can align an llm but those again requires a reference model what Aro does you know in the training F the fine tuning phase itself you know it basically eliminates a reference you can just directly do it in when you are using TR lsft whatever you are doing you can just do it okay so we have an orput trainer now that's a wrapper and that you can just use it now if you look at here you should watch this video okay where I have aligned mistal 7B but here we're going to train Lama 3 let me show you what I am doing guys okay so first thing is you need Transformers data sets accelerate Pi TRL bits and bytes and when B weights and biases because I'm also logging the logs in weights and biases just to see the how the performance has been the overfitting and things like that now once you install that I'm on a00 you need a00 GPU you can also do it on L4 if you need but then you need a smaller amount of data samples to do that okay now scroll down here are all the libraries that I'm have imported you can see I imported torch wend be uh low data sets because I'm going to load the data set from hugging phase I have user data just to take the secrets from the this secret the credentials for w b and then I have Laura config Pi model prepare model for KB training from pip parameter efficient fine-tuning and then from Transformers I'm loading all these libr modules like Auto model for Cal LM because we going to do a text generation task it's not a uh mask language modeling or MLM kind of a stuff it's a text generation thing then we have autot toonize bits and bytes config because we're going to do this in a quantized way the model that we going to Lo probably then Pipeline and then if you look at when I say Quant you're going to use Kora guys probably in this now have look at here we have from TRL it's a Transformer Library UT Oro config now orpo config is part of TRL itself so you can just use that wrapper and I have authenticated with my WB account wb. login you can see this is where my wend be is I will anyway uh this is where I have created my project you can see it's a new project called Lama 3 so Lama 3 is the project that is happening here once all of your logs will be recorded now scroll down a bit now what I'm doing in this case I'm saying okay if I am using the newest architecture of Nvidia gpus or the oldest one on based on M architecture so if you have a00 h00 and things like that then you can use Flash attention tool so in my case it is true because I using a00 so flash attention will be ported flash attention is really critical because of the memory and the GPU compute that you need it basically accelerates your training uh phage now that's what I'm doing then I'm saying notebook loging there are two reasons for it because if you want to find tune the base Lama 38b model it's a gated repository so you have to log in with your credentials so I have already logged in you can see it over here and then what I'm doing next I'm saying base model take this base model which is meta Lama 38b and I'm naming my model as orpo Lama 38b F you can see it over here and I have a bits and bytes config bits and bytes config load in 4bit I'm saying true because we're not going to do a full fine tuning so we are saying load in 4bit and I'm saying nf4 which is a data structure based on quantile quantization so I already have created a fine tuning crash course guys in fine-tuning playlist you should def you must watch this video before any any channel you go on the YouTube or anywhere else you should have basic understanding of this terminologies the data structure the algorithms how all of these things Works what are gradient accumulation how do you decide a learning rate what is nf4 what do you mean by rank what do you mean by alpha everything has been covered in that fine tuning video please watch that I I'll give the link in description now I'm saying use torch D tab type which is BNB 4bit compute and I'm saying use double Quant as true next is I'm using Lowa config where I have a rank of 16 you can start with eight and you can go with 64 if you go higher you need more compute to do that so I have kept it a pretty standard on 16 I using Laura Alpha Dropout bias n Tas type Cal LM as I said it's a text generation thing and Target modules up projection downward projection geted projection everything you should also learn this I have that covered in the video what do you mean by Target mode as we are not not adjusting the weights for each and every layer we are targeting a very specific modules which are compatiable with llama 3 Model you have to go through the research paper to understand this in detail what kind of Target modules you can Target for these kind of models now we have to specifically Target these modules now I'm loading the tokenizer you can see tokenizer and loading the model let me bring my monitor yeah so loading the model in model I'm using a model for Cal lm. from pre-train base model quantization config BNB config I passing the BNB config that I defined over here if you look at this BNB config I'm just defining it over here and then I have a device map Auto because whatever device you can upload something on CPU if you have a very limited compute and then I have an attention implementation which is Flash attention to and then I'm just loading the model in kbit you can see prepare model for kbit that's very important guys you know you should learn all of these uh watch my video I'll recommend that now you can see that this is the model has been loaded completely over here and then I'm using this data set Ultra feedback binarized by hugging F H4 so hugging face H4 has created a DPO specific data uh excuse me uh Oro specific or even for DPO you can use this for DPO as well Ultra feedback binarized there are different types of models that you can data sets excuse me that you can use it uh you can go on hugging face you find it out but I'm using this data set it has let me show you that data set probably quickly and I'll just show you this data set control come here and paste it now this is the data set I using now this data set has a prompt how can I develop a habit of drawing daily there is a choosen answer and there is a rejected you can look at the choosen and rejected column and you can look at the messages score choosen score rejected so each has a choosen and reject Ed how can I develop a habit of drawing daily so the role of user the content developing a daily habit blah blah blah it goes like this so basically aligning the llm guys you know but you have to be really careful your data quality should be of top note otherwise might it might be bias a bit because humans have this inherited bias we in all of us right we have some kind of biases so if we create this kind of data we have to be really careful now this is the data I'm using and I'm having a data set you can see it has around 6 61,000 rows for training and 2,000 for testing because I have splitted that I don't want to use that much so what I did I did a bit of changes here you can see I have a train samples only I want only 5,000 to train I need 5,000 I don't want to go with all the 61,000 because it will take a lot of time this is original train sample then I created a test sample took a ratio of it you can see here and then what I'm doing I have a trend subset test subset and then I have the train sub subset and test subset over here and then you can see what I'm doing here I have a function called and you can now see the number of rows have reduced to 5,000 and number of rows for TR testing has been reduced to 163 now what I'm doing next is I need to apply a map here on the data set choosen and dejected you can see the rows only rows we are applying it chat template the chat template is a function uh it's basically a module in tokenizer class that we have and then what we are doing we are creating two data set zero and data set one basically the nothing but the train and test set and then you can see the printed one 5,000 163 and the thing is there now this is our orpo augs which are important you should you know you should uh understand this a bit okay because these are see I'll I'll tell you a few insights now orpo according to their research paper orpo recommends to have a have a low learning rate when you compare that to traditional sft or you know DPO kind of technique so that's why we are using 0 minus 6 which corresponds to 1 E minus 5 in a safety thing so it's basically the similar stuff now we have max length Max prompt length you know if you have less compute you probably have to deal with this okay you have to reduce these numbers okay I have explained this guys you know training batch size this just in my pre let me show you which video you should watch for that okay if you want to watch that come to AI anytime chat are you ready to learn this this is the video you should watch which is here hyper parameter and training arguments I'll recommend you you watch when I found hostinger and I found out about the website builder I was really Blown Away it made this is the video you should watch guys mastering llm fine tuning hyper parameters and training arguments if you want to understand each and everything about these that you have what are the optim that we are using why are we using paged Adam and not only Adam you know we have a Max STS what the difference between Max STS and number of epo or things like that so these are very important important okay so this is what I'm passing we're reporting to WB output directory result where all of these result will get stored blah blah blah and then I have a trainer class you can see orpo trainer model argument passing the orpo asks train data set evalid assets P config and tokenizer okay now I'm training it you can see trainer. train train. save model new model it will take a it might take a lot of time guys you know to do that but I anyway I've been running it I'll see how much time it might take a might take a few hours guys to you know to get this completed but we will do it we'll try to or probably I will reduce the number of uh uh steps probably we'll do it for 100 or 200 steps now after the training is done how can you add the let me just add text how to how do add uh how to merge rather how to merge Lowa adapters now you will be you will get a new model here and if you want to push that new model again with after merging the adapters how can you do that so first thing that you have to do you have to flush the memory so you have to do Dill trainer and model let me just write the code probably I'll give you this notebook so you can just reproduce The Notebook you just run it and just change the data set if you want to change the data set in that case gc. SCT now we're going to delete everything which is in the cach because the the cash has the volume in we have persisted the volume in cash because we are restoring all the weights in the cache now I'm going to do torch. CA and Dot empty cach this is this is the thing that will basically delete everything empty everything in the catch and now we're going to reload so let me just write reload tokenizer and model excuse me me and then here I'm going to do tokenizer equals Auto tokenizer you can see from pre-trained and then goes the base model and then I'm going to pass my model which is auto model for Cal LM do from pre-trained base model and I'm passing let me pass a few things over here I'm going to use low CPU memory use which is true return dict I will also make this true it's a Boolean value you can see return dick equals true and then I'm going to have torch D type so torch D type torch float 16 and device map Auto we do not need this because we not going to train anything here so now this becomes your model the model is fine now after that we're going to uh uh model model tokenizer set of chat format this is right so we we do this and what else now we're going to merge at with basee model so we have the base model now so we're going to merge it so let me just write merge and then model equals and then you're going to use Pi model so I'm going to use Pi model from pre-rain this is right model and not Pi config this would be new model so we have the new model if you remember which is uh Oro 8B whatever that see that on top now model is done now you're going to use this model equals model do merge and unload so if you do this it will be it will be adapter will be merged and unloaded now you can also push it to hugging phase because most of you ask me this question how to push this now for to push this on hugging face guys you need to have an exess token which the right privilege where you can write the uh model into a repository so I already have done that push underscore 2core H and then you're going to pass your new model thingy so just write new model and and then you're going to use each temp directory as false okay use tempdir this becomes false model do and you can also push the tokenizer otherwise it will give you a config error if you don't do that push to have new model use temperature this is how you can push it guys now if you run this sale after the training step when the training is completed you know I'll of course I'll give you this uh notebook you can try it out now once that is done you can just uh push it to hugging face and you can try it out as well you can also use uh llm eval to eval it guys you know if you want to eval that okay uh let me know if you want to so we have llm Auto eval we have a lot of evaluation guys okay you can see by Maxim Labon okay and you can see automatically evaluate your llms in Google collab this is how you can evaluate using this this notebook Library whatever but there are other as well you can use open Hub you can use any number of others uh to evaluate as as well you have NOS Benchmark suit that you can use it to evaluate so feel free to evaluate that as well if you want to publish it on leaderboards wherever now this will take a lot of time guys probably I'll not wait for it but I just wanted to show you how you can do it let me just download this notebook I'll give it in the GitHub through a GitHub link or something you can see it has been downloaded now this this is how you should I think you should watch orpo video for Mel first then you should watch this one and go through uh implementing the notebook and you will have a fine-tuned llama 3 Model now this is how you can push it on hugging face as well after merging the adapter okay that's all for and here you can before that here you can once that is done here it will be visible guys you can also explore the logs and if you want to explore that but this is what it is guys if you have any question thoughts or feedbacks please let me know in the comment box you can also reach out to me through my social media channels find those information on channel banner and channel about us if you like the content I'm creating please hit the like icon and if you haven't subscribed the channel yet please do subscribe the channel guys that helps me you know to create more such videos in your future thank you so much for watching see you in the next one

Original Description

In this tutorial, I delve into the process of fine-tuning Llama 3 using Odds Ratio Preference Optimization (ORPO), a technique that ensures your LLM aligns with specific ethical standards and preferences more efficiently than ever before. Learn how ORPO not only simplifies the training process but also reduces computational demands, all while boosting performance. This video will guide you through each step, demonstrating how to apply ORPO to Llama 3 and showcasing the remarkable improvements in model alignment and reasoning. 👍 Like, 💬 comment, and 🔔 subscribe to stay at the forefront of AI technology and learn more about enhancing LLMs with ethical alignment. Join this channel to get access to perks: https://www.youtube.com/channel/UC-zVytOQB62OwMhKRi0TDvg/join To further support the channel, you can contribute via the following methods: Bitcoin Address: 32zhmo5T9jvu8gJDGW3LTuKBM1KPMHoCsW UPI: sonu1000raw@ybl GitHub: https://github.com/AIAnytime/Llama-3-ORPO-Fine-Tuning Fine Tuning Crash Course Video: https://www.youtube.com/watch?v=mrKuDK9dGlg&list=PLrLEqwuz-mRIEtuUEN8sse2XyksKNN4Om&index=1 Training Arguments Video: https://www.youtube.com/watch?v=y-9G41zELIY ORPO Mistral Video: https://www.youtube.com/watch?v=32S_xBt2IXw #llama3 #ai #llm
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from AI Anytime · AI Anytime · 0 of 60

← Previous Next →
1 Spelling and Grammar Checking Streamlit App: Building Docker Image
Spelling and Grammar Checking Streamlit App: Building Docker Image
AI Anytime
2 Spelling and Grammar Checking Streamlit App: Docker Image and Docker Hub
Spelling and Grammar Checking Streamlit App: Docker Image and Docker Hub
AI Anytime
3 Image Caption Generator: Google Colab and Hugging Face
Image Caption Generator: Google Colab and Hugging Face
AI Anytime
4 Low Code/No Code AI Platform Teachable Machine: Brain MRI Image Classification
Low Code/No Code AI Platform Teachable Machine: Brain MRI Image Classification
AI Anytime
5 Low Code/No Code AI Platform Teachable Machine: Testing the Model
Low Code/No Code AI Platform Teachable Machine: Testing the Model
AI Anytime
6 Low Code/No Code AI Platform: Streamlit App for Brain MRI Image Classification
Low Code/No Code AI Platform: Streamlit App for Brain MRI Image Classification
AI Anytime
7 Readme Generator Streamlit App using ChatGPT
Readme Generator Streamlit App using ChatGPT
AI Anytime
8 Generate Minutes of Meeting (MoM) from Video using ChatGPT: AI as an API
Generate Minutes of Meeting (MoM) from Video using ChatGPT: AI as an API
AI Anytime
9 The Great AI Showdown: ChatGPT vs ChatSonic 🔥
The Great AI Showdown: ChatGPT vs ChatSonic 🔥
AI Anytime
10 Generating Transcripts and News Article with Whisper, GPT-3.5, ChatGPT and Streamlit
Generating Transcripts and News Article with Whisper, GPT-3.5, ChatGPT and Streamlit
AI Anytime
11 Toxicity Classifier using Machine Learning and NLP
Toxicity Classifier using Machine Learning and NLP
AI Anytime
12 Toxicity Classifier API using FastAPI
Toxicity Classifier API using FastAPI
AI Anytime
13 Toxicity Classifier Streamlit App
Toxicity Classifier Streamlit App
AI Anytime
14 Low-Code Insurance Prediction with PyCaret and Streamlit
Low-Code Insurance Prediction with PyCaret and Streamlit
AI Anytime
15 Deploy Streamlit Python Application for Free
Deploy Streamlit Python Application for Free
AI Anytime
16 GPT3 Powered Text Analytics App
GPT3 Powered Text Analytics App
AI Anytime
17 AI Image Generation Streamlit App
AI Image Generation Streamlit App
AI Anytime
18 Streamlit and txtai: Building an Abstractive Summarization App in Python
Streamlit and txtai: Building an Abstractive Summarization App in Python
AI Anytime
19 Building a Topic Modeling and Labeling app with Streamlit
Building a Topic Modeling and Labeling app with Streamlit
AI Anytime
20 The Art of AI: Exploring Midjourney, Dall-E, and Lexica
The Art of AI: Exploring Midjourney, Dall-E, and Lexica
AI Anytime
21 Exploring the latest Large Language Models (LLaMA and Alpaca)
Exploring the latest Large Language Models (LLaMA and Alpaca)
AI Anytime
22 Comparing LLMs like GPT-X, LLaMA, and Alpaca: Analyzing the Perplexity Score
Comparing LLMs like GPT-X, LLaMA, and Alpaca: Analyzing the Perplexity Score
AI Anytime
23 GPT-3 powered Q&A App using Langchain, GPT-Index, and Gradio
GPT-3 powered Q&A App using Langchain, GPT-Index, and Gradio
AI Anytime
24 All things #ai . Latest and greatest in AI. #tech #python #chatgpt #youtubeshorts #shorts #gpt3
All things #ai . Latest and greatest in AI. #tech #python #chatgpt #youtubeshorts #shorts #gpt3
AI Anytime
25 Text-to-Video Generation using a Generative AI Model
Text-to-Video Generation using a Generative AI Model
AI Anytime
26 #ai brand name generator. #artificialintelligence #tech #shorts #youtubeshorts #youtube #chatgpt
#ai brand name generator. #artificialintelligence #tech #shorts #youtubeshorts #youtube #chatgpt
AI Anytime
27 Talking AGI with Sam Altman: A Deepfake Showcase
Talking AGI with Sam Altman: A Deepfake Showcase
AI Anytime
28 A conversation with ChatGPT creator Sam Altman. #tech #technology #ai #shorts #viral
A conversation with ChatGPT creator Sam Altman. #tech #technology #ai #shorts #viral
AI Anytime
29 Get to Know Anthropic's Claude: The Ultimate ChatGPT Competitor
Get to Know Anthropic's Claude: The Ultimate ChatGPT Competitor
AI Anytime
30 #shorts #chatgpt #python #datascience #tech #coding
#shorts #chatgpt #python #datascience #tech #coding
AI Anytime
31 Recipe Generator App from Cooking Videos using Whisper and ChatGPT
Recipe Generator App from Cooking Videos using Whisper and ChatGPT
AI Anytime
32 Segment Anything Model by Meta AI: An Image Segmentation Model
Segment Anything Model by Meta AI: An Image Segmentation Model
AI Anytime
33 One of the best #ai #books based on #tensorflow. #tech #coding #shorts #chatgpt #machinelearning
One of the best #ai #books based on #tensorflow. #tech #coding #shorts #chatgpt #machinelearning
AI Anytime
34 Music Generation using Mubert #ai . #music #shorts #youtubeshorts #chatgpt #generativeai
Music Generation using Mubert #ai . #music #shorts #youtubeshorts #chatgpt #generativeai
AI Anytime
35 Image to Text Prompt: Reverse Engineering AI Image Generation
Image to Text Prompt: Reverse Engineering AI Image Generation
AI Anytime
36 Image Generation for #ramadan using #ai. #midjourney #chatgpt #shorts #youtubeshorts #islam
Image Generation for #ramadan using #ai. #midjourney #chatgpt #shorts #youtubeshorts #islam
AI Anytime
37 How to build an AI-ready organization: Cultivating a Data-Driven Culture
How to build an AI-ready organization: Cultivating a Data-Driven Culture
AI Anytime
38 Midjourney: Generate AI-powered Images
Midjourney: Generate AI-powered Images
AI Anytime
39 Getting Started with Graphs: A Beginner's Guide (Part 1 of GNN Series)
Getting Started with Graphs: A Beginner's Guide (Part 1 of GNN Series)
AI Anytime
40 Build India's First ChatGPT like App for Politics: BJP-GPT
Build India's First ChatGPT like App for Politics: BJP-GPT
AI Anytime
41 Meet BJP-GPT.... @AIAnytime  #bjp #news #shorts #tech #chatgpt #ai #youtubeshorts #coding #video
Meet BJP-GPT.... @AIAnytime #bjp #news #shorts #tech #chatgpt #ai #youtubeshorts #coding #video
AI Anytime
42 ChatPDF... #chatgpt  for PDF files. #ai #generativeai #shorts #youtubeshorts #coding #tech #ai
ChatPDF... #chatgpt for PDF files. #ai #generativeai #shorts #youtubeshorts #coding #tech #ai
AI Anytime
43 Free AI Image Generation #ai #chatgpt #coding #tech #shorts #youtubeshorts #shortvideo #generativeai
Free AI Image Generation #ai #chatgpt #coding #tech #shorts #youtubeshorts #shortvideo #generativeai
AI Anytime
44 Transform old photos into Vibrant Memories with Deoldify AI: Build a Streamlit App
Transform old photos into Vibrant Memories with Deoldify AI: Build a Streamlit App
AI Anytime
45 Open Assistant: The Real Open-sourced LLM
Open Assistant: The Real Open-sourced LLM
AI Anytime
46 Thanks to @YannicKilcherand team for the open sourced LLM Open Assistant. #ai #shorts #tech
Thanks to @YannicKilcherand team for the open sourced LLM Open Assistant. #ai #shorts #tech
AI Anytime
47 Search Engine for AI generated images. #ai #tech #technology #generativeai #chatgpt  #shorts #video
Search Engine for AI generated images. #ai #tech #technology #generativeai #chatgpt #shorts #video
AI Anytime
48 Generative AI Video Platform "Synthesia" #shorts #youtubeshorts #ai #tech #chatgpt #generativeai
Generative AI Video Platform "Synthesia" #shorts #youtubeshorts #ai #tech #chatgpt #generativeai
AI Anytime
49 Text to speech Voice AI platform. #shorts #youtubeshorts #ai #tech #technology #python #coding
Text to speech Voice AI platform. #shorts #youtubeshorts #ai #tech #technology #python #coding
AI Anytime
50 Create Amazing Videos with ChatGPT and Pictory: Free AI-powered Video Creation
Create Amazing Videos with ChatGPT and Pictory: Free AI-powered Video Creation
AI Anytime
51 Want to create beautiful video using #chatgpt and #pictory ? Watch the tutorial on channel. #ai
Want to create beautiful video using #chatgpt and #pictory ? Watch the tutorial on channel. #ai
AI Anytime
52 Animate your photos using AI. Bring old family photos to life. #ai #tech #shorts #shortvideo #coding
Animate your photos using AI. Bring old family photos to life. #ai #tech #shorts #shortvideo #coding
AI Anytime
53 Create a PDF Search and Summarization Tool in less than 100 Lines of Code: GPT-Index and Streamlit
Create a PDF Search and Summarization Tool in less than 100 Lines of Code: GPT-Index and Streamlit
AI Anytime
54 Text to Video Generation using Videocrafter: Intuitive Math behind Latent Diffusion Model
Text to Video Generation using Videocrafter: Intuitive Math behind Latent Diffusion Model
AI Anytime
55 Gamma AI: Create presentation PPT easily with #ai . #chatgpt #shorts #shortvideo #tech #coding
Gamma AI: Create presentation PPT easily with #ai . #chatgpt #shorts #shortvideo #tech #coding
AI Anytime
56 Tripnotes: Free AI tools for your trip planning. #ai #chatgpt #shorts #youtubeshorts #video
Tripnotes: Free AI tools for your trip planning. #ai #chatgpt #shorts #youtubeshorts #video
AI Anytime
57 Meet Bark (New Text to Speech Model): Clone Any Voice to Generate Music and Speech
Meet Bark (New Text to Speech Model): Clone Any Voice to Generate Music and Speech
AI Anytime
58 Fliki: The free AI video creation tool. #ai #shorts #shortvideo #youtubeshorts #chatgpt #tech #news
Fliki: The free AI video creation tool. #ai #shorts #shortvideo #youtubeshorts #chatgpt #tech #news
AI Anytime
59 Ask Anything Tool: Chat with Your Video using ChatGPT, MiniGPT4, and StableLM
Ask Anything Tool: Chat with Your Video using ChatGPT, MiniGPT4, and StableLM
AI Anytime
60 HuggingChat: Open Source ChatGPT (Interface and Model)
HuggingChat: Open Source ChatGPT (Interface and Model)
AI Anytime

This video tutorial teaches how to fine-tune Llama 3 using the Odds Ratio Preference Optimization (ORPO) technique, which ensures LLMs align with specific ethical standards and preferences. The tutorial covers the process of fine-tuning Llama 3, including installing required libraries and datasets, logging performance and overfitting, and using ORPO trainer to fine-tune the model.

Key Takeaways
  1. Install required libraries and datasets
  2. Log performance and overfitting in Weights and Biases
  3. Use ORPO trainer to fine-tune Llama 3
  4. Configure ORPO for fine-tuning
  5. Use 4bit quantization
  6. Use nf4 data structure
  7. Load tokenizer and model using BNB config and device map
  8. Prepare model for kbit
  9. Load Ultra feedback binarized dataset
  10. Apply data augmentation to dataset
💡 The ORPO technique simplifies the training process and eliminates the need for a separate reference model, making it a cost-effective and efficient method for aligning LLMs with specific ethical standards and preferences.

Related Reads

📰
I ran a 110B LLM on 16GB of RAM. Here's the equation that predicts any model's speed on your machine
Learn how to predict a large language model's speed on your machine using a simple equation, and discover how to run a 110B LLM on limited RAM
Dev.to · Federico Sciuca
📰
A Fidelity-First Workflow for Editing GPT-Generated Text
Learn a fidelity-first workflow for editing GPT-generated text to improve its quality and readability
Dev.to · Bisrat
📰
Never Let the Model Pick the Tenant ID: Securing an LLM Agent in Go
Secure your LLM agent by controlling tenant ID selection and implementing server-side identity, OAuth, and rate limits to prevent unauthorized access
Dev.to · Jules Robineau
📰
The Research Assistant in the Room
Learn how to build a Research Assistant like Omnist in two weeks with a team of one, leveraging AI and ML concepts
Dev.to · Thomas Lee
Up next
5 Levels of AI Agents - From Simple LLM Calls to Multi-Agent Systems
Dave Ebbelaar (LLM Eng)
Watch →