Fine-tuning Large Language Models (LLMs) | w/ Example Code

  Рет қаралды 376,863

Shaw Talebi

Shaw Talebi

Күн бұрын

Пікірлер: 321
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
UPDATE: Someone pointed out that the fine-tuned model here is overfitting, so I created an improved example that uses transfer learning: kzbin.info/www/bejne/aoKrmGt_rZ2KjbM 👉More on LLMs: kzbin.info/aero/PLz-ep5RbHosU2hnz5ejezwaYpdMutMVB0 -- References [1] Deeplearning.ai Finetuning Large Langauge Models Short Course: www.deeplearning.ai/short-courses/finetuning-large-language-models/ [2] arXiv:2005.14165 [cs.CL] (GPT-3 Paper) [3] arXiv:2303.18223 [cs.CL] (Survey of LLMs) [4] arXiv:2203.02155 [cs.CL] (InstructGPT paper) [5] PEFT: Parameter-Efficient Fine-Tuning of Billion-Scale Models on Low-Resource Hardware: huggingface.co/blog/peft [6] arXiv:2106.09685 [cs.CL] (LoRA paper) [7] Original dataset source - Andrew L. Maas, Raymond E. Daly, Peter T. Pham, Dan Huang, Andrew Y. Ng, and Christopher Potts. 2011. Learning Word Vectors for Sentiment Analysis. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, pages 142-150, Portland, Oregon, USA. Association for Computational Linguistics.
@salamsoftyt
@salamsoftyt 5 ай бұрын
@salamsoftyt
@salamsoftyt 5 ай бұрын
I
@beaux2572
@beaux2572 Жыл бұрын
Honestly the most straightforward explanation I've ever watched. Super excellent work Shaw. Thank you. It's so rare to find good communicators like you!
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
Thanks, glad it was clear 😁
@yannicbrose
@yannicbrose 4 ай бұрын
Fully agree!
@otorishingen8600
@otorishingen8600 12 күн бұрын
Finally a linear tutorial actually talking about what, how, why without trying to funny with meta humor and fluff Thank you - great explanation
@JaishreeramCoder
@JaishreeramCoder 8 ай бұрын
You have explained this so clearly, that even a novice in NLP can understand it.
@lukaboljevicboljevic
@lukaboljevicboljevic 10 ай бұрын
Such a great video. This is the first one I watched from you. You explain everything so nicely, and in my opinion you provided just the right amount of information - not too little, so it doesn't feel superficial and you feel like you've learned something, but not too much, so that you can take what you've learned and read more about it yourself if you're interested. Looking forward to seeing more of your content!
@ShawhinTalebi
@ShawhinTalebi 10 ай бұрын
Great to hear! Glad it was clear :)
@xugefu
@xugefu 8 ай бұрын
Thanks!
@ShawhinTalebi
@ShawhinTalebi 7 ай бұрын
Thanks for the support! Glad it was helpful :)
@srinivasguptha9538
@srinivasguptha9538 10 ай бұрын
One thing that really standout for me is not using Google Colab for explanation. Explaining all code without scrolling helps the audience better grasp the content as it goes with the flow without waiting for the code to execute and helps the audience to remember where the variables were defined and all. Great approach and thanks for the amazing content!
@ShawhinTalebi
@ShawhinTalebi 10 ай бұрын
Thanks, that's good feedback! I'll keep this in mind for future videos.
@checkdgt
@checkdgt 10 ай бұрын
Just came to this video from HF and I have to say, I love they way you describe this! Thanks for the great video!
@ShawhinTalebi
@ShawhinTalebi 10 ай бұрын
Great to hear! Thanks for watching :)
@balubalaji9956
@balubalaji9956 5 ай бұрын
Hey KZbin algorithm , I loved this video . suggest me more of them
@ShawhinTalebi
@ShawhinTalebi 5 ай бұрын
Here's the series playlist: kzbin.info/aero/PLz-ep5RbHosU2hnz5ejezwaYpdMutMVB0
@junjieya
@junjieya Жыл бұрын
A very clear and straightforward video explaining finetuning.
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
Glad it was clear :)
@fakharmursaleen9889
@fakharmursaleen9889 4 ай бұрын
Hands down one of the most best explanations on youtube keep it up homie
@jonathanleroy269
@jonathanleroy269 3 ай бұрын
This video series is underrated. Loved it, thank you!
@Josia-p5m
@Josia-p5m 4 ай бұрын
You're a fantastic communicator - this was very helpful. I would love to see more walkthroughs like this that have a good balance of theory, math and python.
@ShawhinTalebi
@ShawhinTalebi 3 ай бұрын
More to come!
@BRK326
@BRK326 2 ай бұрын
Nice job, efficient , straight forward, enough detail for learning big picture without confusion.
@egemenklc2515
@egemenklc2515 4 ай бұрын
Hey KZbin, I really liked this kind of machine learning and fine tuning topics. Please recommend me more of these.
@ShawhinTalebi
@ShawhinTalebi 4 ай бұрын
Glad you liked it :)
@ayyanarjayabalan
@ayyanarjayabalan 7 ай бұрын
Excellent way of teaching. Keep doing this kind of good work.
@scifithoughts3611
@scifithoughts3611 11 ай бұрын
Great video Shaw! It was a good balance between details and concepts. Very unusual to see this so well done. Thank you.
@ShawhinTalebi
@ShawhinTalebi 11 ай бұрын
Glad you enjoyed it!
@saraesshaimi
@saraesshaimi 8 ай бұрын
excellent simple explanation to the point. Love it !
@yoffel2196
@yoffel2196 Жыл бұрын
Wow dude, just you wait, this channel is gonna go viral! You explain everything so clearly, wish you led the courses at my university.
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
Thanks for the kind words! Maybe one day 😉
@AbdulademAljamel-n5d
@AbdulademAljamel-n5d Жыл бұрын
I was struggling to understand some details, before this video, thanks a lot
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
Great to hear. I’m glad it helped!
@abdullaa9478
@abdullaa9478 Ай бұрын
Thanks!
@ShawhinTalebi
@ShawhinTalebi Ай бұрын
Thank you 🙏🙏🙏
@dendi1076
@dendi1076 11 ай бұрын
this channel is going to hit 6 figure subscribers at this rate
@ShawhinTalebi
@ShawhinTalebi 11 ай бұрын
I hope so 😅
@sreeramch
@sreeramch 10 ай бұрын
Thank you for the detailed explaination line by line. Finally a place, I can rely on with working example
@ShawhinTalebi
@ShawhinTalebi 10 ай бұрын
Glad it was helpful!
@alikarooni9713
@alikarooni9713 11 ай бұрын
Even though this was high level instruction, it was perfect. I can continue from here. Thanks Shahin jan!
@ShawhinTalebi
@ShawhinTalebi 11 ай бұрын
Glad it helped!
@rubencabrera8519
@rubencabrera8519 Жыл бұрын
This was one of the best videos on this topic, really nice man, keep going.
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
Thanks! Glad it was clear :)
@thehousehusbandcn5074
@thehousehusbandcn5074 Жыл бұрын
You are the man! No BS, just good useful info
@ShawhinTalebi
@ShawhinTalebi 11 ай бұрын
Thanks, glad it was helpful 😁
@arunshrestha791
@arunshrestha791 8 ай бұрын
Clear Explanation, Amazing
@salmaelbarbori579
@salmaelbarbori579 10 ай бұрын
Clear and straightforward to the point, thanks a lot for making this valuable content accessible on ytb💡
@ShawhinTalebi
@ShawhinTalebi 10 ай бұрын
Happy to help!
@Random-bq8qc
@Random-bq8qc 6 ай бұрын
Thanks for the well defined video because it helped me prepare my proposal related to this topic.
@azizhassouna9919
@azizhassouna9919 7 ай бұрын
Im really gratful for youre work , you really help me when I had no one to ask .
@jasoncole3253
@jasoncole3253 Жыл бұрын
Well done, even if I already knew all this shit it was really nice to listen to your clear explanation
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
lol! Glad you enjoyed it :)
@lotusluthor
@lotusluthor 7 ай бұрын
Finally something that I can grok!!!! Fantastic tutorial!
@Akshatgiri
@Akshatgiri 10 ай бұрын
This is gonna come handy. Thanks for breaking it down
@ShawhinTalebi
@ShawhinTalebi 10 ай бұрын
Happy to help!
@EigenA
@EigenA 9 ай бұрын
Great video, I wanted to hear further discussion on mitigation techniques for overfitting. Thanks for making the video!
@saadati
@saadati Жыл бұрын
Amazing video Shawhin. It was quite easy to follow and stuff were clearly explained. Thank you so much,
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
Thanks! I'm glad it was clear and helpful
@janjiavicii1328
@janjiavicii1328 3 ай бұрын
very explicit explanation. Thanks!
@soudaminipanda
@soudaminipanda 6 ай бұрын
Thanks for these great videos. I really love the fact that you focus on building an intuitive understanding as opposed to throwing jargons. Could you please start a langchain series?
@ShawhinTalebi
@ShawhinTalebi 6 ай бұрын
Great suggestion! I'll add that to my list. In the meantime, I have a code tutorial using LangChain here: kzbin.info/www/bejne/ZpTJaKmwgsSXkJIsi=Iyc1GzQ7g-A_n5Rr&t=1359
@SaharAbo-y5d
@SaharAbo-y5d 7 ай бұрын
Your style of conveying information is wonderful. Good luck to you
@alokkale2718
@alokkale2718 2 ай бұрын
Bro you are the best instructor
@ShawhinTalebi
@ShawhinTalebi 2 ай бұрын
Thank you, glad it was clear 🙏
@bruceyin603
@bruceyin603 3 ай бұрын
Very good explain about fine tune, thanks Shaw
@richardpinter9218
@richardpinter9218 Жыл бұрын
Fantastic video. Thanks for the upload. Keep up the good work, you're awesome 😎
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
Thanks, I’m glad you liked it 😁
@sakarsalunke3245
@sakarsalunke3245 2 ай бұрын
Indepth overview of fine tuning!
@kevon217
@kevon217 11 ай бұрын
Excellent walkthrough
@ShawhinTalebi
@ShawhinTalebi 11 ай бұрын
🙏
@melliott117
@melliott117 9 ай бұрын
Really great content. I love your balance of details and overview. It’s made it easy for me as a newcomer who is interested in details. My only criticism/advice is that you edit to remove silence. This is great for minimizing pauses mid sentence. But it would be helpful to have slightly more time at the end of each thought/point. Pausing for that extra 0.25 seconds at the end of a coherent teaching point helps greatly.
@ShawhinTalebi
@ShawhinTalebi 9 ай бұрын
Thanks, that's good feedback! I do get a bit heavy-handed with the edits 😅
@alex70301
@alex70301 Жыл бұрын
Best video on llm fine tuning. Very concise and informative.
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
Thanks! Glad you liked it :)
@rma1563
@rma1563 5 ай бұрын
I needed to know how parameter efficient finetuning works to finetune a voice encoder for emotion detection task. This video helped me a lot. I used LoRA for it. Thanks ❤
@ShawhinTalebi
@ShawhinTalebi 5 ай бұрын
Glad it was helpful!
@mookiejapan7351
@mookiejapan7351 10 ай бұрын
Wow! Amazing make-up! If it wasn't for the voice, I wouldn't believe this is actually David Cross!
@ShawhinTalebi
@ShawhinTalebi 10 ай бұрын
Haha, I was wearing jean shorts while filming this 😂
@RealNikolaus
@RealNikolaus Жыл бұрын
Very good video and explanation!
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
Glad it helped!
@sanderkempen6744
@sanderkempen6744 Жыл бұрын
Thanks
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
Wow, thanks so much! I’m glad it was valuable
@sanderkempen6744
@sanderkempen6744 Жыл бұрын
@@ShawhinTalebi just out of sheer curiosity, how much do you get to keep from those euros?
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
Not sure, this is the first time this has happened 😂. Google website says 70%
@sanderkempen6744
@sanderkempen6744 Жыл бұрын
@@ShawhinTalebi i guess that is more than I expected. Anyway thanks for the videos and enjoy your ?coffee? (No idea what the prive levels are in your natural habitat)
@ajeethsuryash5123
@ajeethsuryash5123 5 ай бұрын
Very informative video. Thanks for sharing
@upadisetty
@upadisetty 10 ай бұрын
Best video i saw. thanks a ton for sharing. glad i found right place
@PrinceSinghal-j8m
@PrinceSinghal-j8m 10 ай бұрын
i was amazing ....thanks for uploading Shaw
@ShawhinTalebi
@ShawhinTalebi 10 ай бұрын
Thanks, happy to help!
@Wei-KuoLi
@Wei-KuoLi 8 ай бұрын
Very good & simple showcase, thanks
@payam-bagheri
@payam-bagheri Жыл бұрын
Great video, Shawhin!
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
Thanks, glad you enjoyed it!
@hoseinmirhoseini6013
@hoseinmirhoseini6013 4 ай бұрын
Thank you for the great content.
@simplyshorts748
@simplyshorts748 9 ай бұрын
Great video! I love good explainations
@Mastin70
@Mastin70 9 ай бұрын
Fantastic explanation.
@tintumarygeorge9309
@tintumarygeorge9309 Жыл бұрын
Thank you, Keep up the good work
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
Thanks, happy to help!
@younespiro
@younespiro Жыл бұрын
amazing video, very well explained
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
Glad it helped! Thanks :)
@yb3134
@yb3134 10 ай бұрын
Very well explained
@tgyawali
@tgyawali 10 ай бұрын
I found you in youtube just today. Your presentation style, quality of content is very good. Keep up the great work. I am very passionate about AI technology in general, have been trying to conduct basic trainings to undergraduate college students and would love to connect to collaborate if you are interested. Thank you for doing this!
@ShawhinTalebi
@ShawhinTalebi 10 ай бұрын
Thanks for watching! Glad it was clear :) Feel free to set up a call if you like: calendly.com/shawhintalebi
@tgyawali
@tgyawali 10 ай бұрын
@@ShawhinTalebi Thank you. I will set up some time to connect.
@Kevin.Kawchak
@Kevin.Kawchak 9 ай бұрын
Thank you for the discussion
@swaykao1703
@swaykao1703 Ай бұрын
thank you! I like your vedios, they help me a lot!
@ITforGood
@ITforGood Жыл бұрын
Thanks Shaw, very helpful.
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
Glad it was helpful!
@heatherbrm
@heatherbrm 9 ай бұрын
here, you earned this: 👑
@ShawhinTalebi
@ShawhinTalebi 8 ай бұрын
Thanks 🤴
@jijie133
@jijie133 7 ай бұрын
Great video. Thank you.
@Bboreal88
@Bboreal88 10 ай бұрын
My next question after this video would be on how to pack this fine-tuned model into a UI and deploy.
@ShawhinTalebi
@ShawhinTalebi 10 ай бұрын
Great question. I discussed how to create a chat interface with Hugging Face + Gradio in a previous video: kzbin.info/www/bejne/oJLRYWqdodSUiMk
@NateKrueger805
@NateKrueger805 Жыл бұрын
Nicely done!
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
Thanks!
@bitschips
@bitschips 10 ай бұрын
So educative, thanks a lot!
@ramp2011
@ramp2011 11 ай бұрын
Excellent..... Thank you for sharing
@ShawhinTalebi
@ShawhinTalebi 11 ай бұрын
My pleasure, glad you liked it!
@zeusgamer5860
@zeusgamer5860 Жыл бұрын
HI Shaw, amazing video - very nicely explained! Would be great if you could also do a video (with code examples) for Retrieval Augmented Generation as an alternative to fine-tuning :)
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
Great suggestion. I have a few follow-up use cases planned out and RAG will definitely be part of it.
@BamiCake
@BamiCake Жыл бұрын
​@@ShawhinTalebimaybe also how to fine tune openai model too?
@ShawhinTalebi
@ShawhinTalebi 10 ай бұрын
Just dropped! kzbin.info/www/bejne/aoOkp32qaMuKpas
@chilupuriharshitha7261
@chilupuriharshitha7261 3 ай бұрын
Hey, It was good but did your Model also take a lot of time to get fine-tuned while you were Pluging everything to the Trainer Class as for me it's taking nearly i lost the time it is taking but 10 epochs are getting trained for every 0.05 it/s.
@ShawhinTalebi
@ShawhinTalebi 3 ай бұрын
Are you running this locally?
@aldotanca9430
@aldotanca9430 Жыл бұрын
Very clear, thanks!
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
Thanks Aldo!
@raffelravionaldo463
@raffelravionaldo463 3 ай бұрын
Thank you, is a nice video and you have a clear explanation, actually I try to do this with GPT Neo model (EleutherAI/gpt-neo-1.3B) but when I do training, the Training Loss always have no log values and Validation Loss always NaN (when do it with BERT or distilbert, is run perfectly), Do you have any suggestions or reading resources to fix this?
@ShawhinTalebi
@ShawhinTalebi 3 ай бұрын
Hard to say without seeing the code. Perhaps you can share more info here: www.shawhintalebi.com/contact
@machireddyshyamsunder987
@machireddyshyamsunder987 10 ай бұрын
Thankyou very much it is really very useful .
@ShawhinTalebi
@ShawhinTalebi 10 ай бұрын
Happy to help!
@arthurs6405
@arthurs6405 9 ай бұрын
This was beautifully described. I wish you had provided a Linux alternative for the "model.to('mps/cpu'). I have a linux workstation and a p100 gpu. Also, you did not include the means to save your newly trained model. I think most of us students would appreciate knowing how to save the model locally and to huggingface. Thanks for your efforts.
@ShawhinTalebi
@ShawhinTalebi 9 ай бұрын
I do fine-tuning on a Linux machine here: kzbin.info/www/bejne/jqHSfHVpqtiggcU
@goinsgroove
@goinsgroove 5 ай бұрын
Loving the info! Do you have a video on self-supervised training? I want to train a llm to write in my style.
@ShawhinTalebi
@ShawhinTalebi 5 ай бұрын
Not yet! But I think I'll do this for my next video because of your comment :)
@goinsgroove
@goinsgroove 5 ай бұрын
@@ShawhinTalebi AWSOME!
@nandkumarghatge5152
@nandkumarghatge5152 4 ай бұрын
great video.
@MannyBernabe
@MannyBernabe 11 ай бұрын
Excellent walk-thru. Thank you, Shaw!I was getting errors on the new model. Switching the device worked for me. # Check if CUDA is available and set the device accordingly device = 'cuda' if torch.cuda.is_available() else 'cpu' model.to(device) # Move the model to the appropriate device (GPU or CPU)
@ShawhinTalebi
@ShawhinTalebi 10 ай бұрын
Thanks Manny! That's a good note, I wasn't able to test the code on a non-Mac machine.
@lucycaffrey-maffei6666
@lucycaffrey-maffei6666 3 ай бұрын
thank you sooo much for this content, it's so helpful and clear!!! if i don't use LoRa when fine-tuning and instead just specify `Trainer(model=AutoModelForSequenceClassification.from_pretrained( model_checkpoint, num_labels=2)` (which is what huggingface does in most of its documentation), what type of parameter training is that performing? retraining all of the parameters?
@ShawhinTalebi
@ShawhinTalebi 3 ай бұрын
Yes, that will do full retraining!
@KaptainLuis
@KaptainLuis Жыл бұрын
So nice video thank you soooo much!!❤
@ShawhinTalebi
@ShawhinTalebi 11 ай бұрын
Happy to help 😁
@vicenteenriquemachacaarced2103
@vicenteenriquemachacaarced2103 7 ай бұрын
Thank you so much for that video. ¿From where did you get TRAINING loss metrics? In the console and in the trainer_state.json, I only see evaluation metrics.
@ShawhinTalebi
@ShawhinTalebi 7 ай бұрын
Great question. The training loss is predefined as a property of the base model, so no need to redefine that explicitly.
@totalcooljeff
@totalcooljeff Жыл бұрын
Random question i how do you edit you audio clips together to make them so seamless because idk where to mate them. And great video by the way 👍
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
I use iMovie :)
@rbrowne4255
@rbrowne4255 Жыл бұрын
Fantastic job on this overview, as for other videos, I don't see many videos on Inference scaling, i.e requirements for concurrency, latency etc...what are the hardware requirements i.e number of GPUs per systems or number of systems, etc
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
I'm glad it was helpful :) That's is a great suggestion. I will add it to my list. Thank you!
@pawan3133
@pawan3133 8 ай бұрын
Thanks for the beautifully explanation!! When you said, for PEFT "we augment the model with additional parameters that are trainable", how do we add these parameters exactly? Do we add a new layer? Also, when we say "%trainable parameters out of total parameters", doesn't that mean that we are updating a certain % of original parameters?
@Throwingness
@Throwingness 11 ай бұрын
Very good. Very fast and also easy to follow. As far as future content, keep us posted about how to do LoRA on quantized models. How can the future be anything but LoRA on quantized models?!?!?!?
@ShawhinTalebi
@ShawhinTalebi 11 ай бұрын
Thanks, glad you liked it. Video coming this quarter on exactly that!
@zsmj820
@zsmj820 8 ай бұрын
Nice video !
@liaoyixu6882
@liaoyixu6882 5 ай бұрын
Very amazing video!!! I have one question: when I use your code to fine-tune the model with my own dataset, but since my dataset is too large it leads to memory error (not gpu memory) when I read the dataset, what should I do to avoid this issue? Can I read and fine-tune in a small batch?
@ShawhinTalebi
@ShawhinTalebi 5 ай бұрын
You can try reducing the batch size. Also happy to help troubleshoot via office hours: calendly.com/shawhintalebi/office-hours
@FalahgsGate
@FalahgsGate 7 ай бұрын
thanks for sharing this video ....but Is the technique of fine-tuning model for the custom dataset better than the technique of using the RAG system for LLM Apps. or reverse
@ShawhinTalebi
@ShawhinTalebi 7 ай бұрын
While the best choice of technique will depend on the specific use case, here's the intuition I've gathered. RAG is great when you want the AI to have access to specific knowledge. Fine-tuning is great when you want the AI to provide responses in a particular format and style. Additionally, the techniques are not mutually exclusive, so they can be combined to potentially provide even better results.
@naehalmulazim
@naehalmulazim 8 ай бұрын
Greetings! Really nice tutorial! THANK YOU for including Lora! I need to train an Llm on a higher level language we wrote in C++, to produce our code. It's all private infrastructure. Time isnt an issue but I'd like to do it locally on a mac m2 if I can and was considering Lora on a tiny llm. Is this going to be possible?
@ShawhinTalebi
@ShawhinTalebi 8 ай бұрын
While I haven't done that myself, that is surely possible. The challenge I've run into is that many open-source models don't work so easily on Mac, but I plan to figure it out and many video about it.
@ShawhinTalebi
@ShawhinTalebi 4 ай бұрын
Update: I got a fine-tuning example working locally on my M1 Mac Mini :) Here's a similar example running on my Mac: kzbin.info/www/bejne/aYGsopuah9-brqc
@evan7306
@evan7306 8 ай бұрын
Thank you for your great tutorial! What I don't understand is how to use the fine tuned model as an API so we can use it on website. Do you have any tutorial about that?
@ShawhinTalebi
@ShawhinTalebi 7 ай бұрын
Great question. I haven't covered that yet, but a common approach is to containerize the model using Docker and equipping it with an API using a library like FastAPI. Then you can host that on a local server or via a cloud provider.
@devtest202
@devtest202 9 ай бұрын
Hi thanks!! A question for a model in which I have more than 2,000 pdfs. Do you recommend improving the handling of vector databases? When do you recommend fine tunning and when do you recommend vector database
@ShawhinTalebi
@ShawhinTalebi 9 ай бұрын
Great question! Generally, fine-tuning and RAG have different strengths. Fine-tuning is great when you want to endow the model with a particular style or to tailor completions for a particular use case, while RAG is good to provide the model with specialized and specific knowledge.
@lauraharyo1128
@lauraharyo1128 9 ай бұрын
Thanks a lot for such a straightforward walkthrough! I tried a similar code for a text generation model, but I keep getting the error 'ValueError: prefetch_factor option could only be specified in multiprocessing. Let num_workers > 0 to enable multiprocessing.' Do you know why this keeps happening? I've even tried changing the torch version, but it's not working.
@ShawhinTalebi
@ShawhinTalebi 9 ай бұрын
Not sure that could be. Does the machine have a GPU?
@lauraharyo1128
@lauraharyo1128 9 ай бұрын
@@ShawhinTalebi Thanks for your help! I figured out the issue was an outdated Linux kernel.
@amanpreetsingh8100
@amanpreetsingh8100 Жыл бұрын
This was a great video. I have one question though. In the LoRA demonstration in your video(at ~14 minutes) you mention this operation (W0 + BA)x = h(x), in this how the sum (W0 + BA) is possible, as W0 has dimentions d*k, and output of operation BA would have the dimentions r*r. This matrix sum is not mathematiaclly possible. So can you elaborate more on this...
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
Good question! The math works out here because B is d x r and A is r x k, therefore BA will be d x k.
@amanpreetsingh8100
@amanpreetsingh8100 Жыл бұрын
@@ShawhinTalebi 👍
@SolomonManuelraj
@SolomonManuelraj Жыл бұрын
Nice Video. I need your help to clarify my doubt. When we do the PEFT based finetuning, the final finetuned model size (in KBs/GBs) will increase by the additional parameters ( base model size + additional parameters size) . In this case base model size will be lesser and final finetuned model size will be more. Deploying the final finetuned model in the edge devices will be more difficult because of the limited edge device resources. Are there any way adapters / LoRA can help in reducing the final finetuned model memory size so that easily we can deploy the final model in the edge devices? Your insights will be helpful. Currently i am working in the vision foundation model deployment in the edge device where i am finding it difficult to deploy because of vision foundation model memory size and inference speed.
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
Great question. PEFT methods like LoRA only reduce the number of trainable parameters not the total number of parameters. And to your point, the storage requirements actually increase in the case of LoRA! To reduce the final model size, you will need to fine-tune a smaller base model. Hope that helps!
@samadhanpawar6554
@samadhanpawar6554 Жыл бұрын
Can you recommend any course where i can learn to build llm from scratch and fine-tune in depth
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
Paul Iusztin has some good content on that. Hands-on-llms: github.com/iusztinpaul/hands-on-llms More resources: www.pauliusztin.me/
@RocktCityTim
@RocktCityTim 11 ай бұрын
Hi Shaw - this answered so many questions about specializing an LLM in concise terms, thanks! One question that I'm running up against is physical machine abilities (CPU Speed/Cores, System Memory, GPU cores and memory, and storage speeds. In my case, I have a 32/64 core/thread Epyc CPU on PCIE4.0 MB with 128GB of DDR4 RAM and a PNY/NVIDIA RTX A5000 with 24GB DDR5 VRAM and 8192 CUDA cores dedicated to ML/AI (video is via a separate RTX A2000 GPU). With that info, what should I be looking at as a starting point that will take full advantage of those specs in local mode?
@ShawhinTalebi
@ShawhinTalebi 11 ай бұрын
Wow that's a lot of firepower. While I'm less knowledgeable about the ML engineering side of things, I'd suggest checking out DeepSpeed: github.com/microsoft/DeepSpeed. They have several resources on training/running large models efficiently.
@RocktCityTim
@RocktCityTim 11 ай бұрын
@@ShawhinTalebi Thatnks for the pointer. And thinks for all of your output. I've picked up some great information.
@elrecreoadan878
@elrecreoadan878 Жыл бұрын
Would a botpress with a vector kb connected to chatgpt would be enough for Q&A ? When fine tuning starts to be neededvand is there an inexpensive way to do it with no or low code? Thank you!
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
This depends on the use case. However, taking a quick-and-easy no code approach to start is never a bad idea. It typically gives you a sense of how sophisticated approaches will pan out. Fine-tuning will come into play when the "quick-and-easy" starts to becomes too inconvenient (or expensive) due to the scale of the solution. Hope that helps!
@aketo8082
@aketo8082 8 ай бұрын
Thank you. Is there a chance to create own LLM on own computer? A small version? Thank you for information.
@ShawhinTalebi
@ShawhinTalebi 8 ай бұрын
It depends what you consider a "Large" Language Model. ~100M parameters is probably the practical limit for (heavy-duty) consumer hardware, at least for now.
@aketo8082
@aketo8082 8 ай бұрын
@@ShawhinTalebi Maybe there is a small standard LLM available, which is possible to extend/train/finetune with own data. So the first step for the language rule are available. I have now idea if this is possible, that's why I ask, but could be possible.
@harshanaru1501
@harshanaru1501 Жыл бұрын
Such a great video ! Wondering how self supervised fine tuning works. Is there any video available on that ?
@ShawhinTalebi
@ShawhinTalebi Жыл бұрын
Thanks! I found this on self-supervised fine-tuning: kzbin.info/www/bejne/i6SYi3mmZpuDl7c
How to Improve LLMs with RAG (Overview + Python Code)
21:41
Shaw Talebi
Рет қаралды 87 М.
RAG vs. Fine Tuning
8:57
IBM Technology
Рет қаралды 94 М.
Жездуха 42-серия
29:26
Million Show
Рет қаралды 2,6 МЛН
UFC 287 : Перейра VS Адесанья 2
6:02
Setanta Sports UFC
Рет қаралды 486 М.
БОЙКАЛАР| bayGUYS | 27 шығарылым
28:49
bayGUYS
Рет қаралды 1,1 МЛН
Fine-Tuning BERT for Text Classification (Python Code)
23:24
Shaw Talebi
Рет қаралды 9 М.
Attention in transformers, visually explained | DL6
26:10
3Blue1Brown
Рет қаралды 1,9 МЛН
Prompt Engineering: How to Trick AI into Solving Your Problems
29:58
How to Build an LLM from Scratch | An Overview
35:45
Shaw Talebi
Рет қаралды 283 М.
Transformers (how LLMs work) explained visually | DL5
27:14
3Blue1Brown
Рет қаралды 4,1 МЛН
QLoRA-How to Fine-tune an LLM on a Single GPU (w/ Python Code)
36:58
"okay, but I want Llama 3 for my specific use case" - Here's how
24:20
Жездуха 42-серия
29:26
Million Show
Рет қаралды 2,6 МЛН