How to Fine-Tune Mistral 7B on Your Own Data

  Рет қаралды 58,307

Brev

Brev

9 ай бұрын

Hi! Harper Carroll from Brev.dev here. In this tutorial video, I walk you through how to fine-tune Mistral 7B, which outperforms Llama 2 13B on all tested benchmarks, on your own data.... like how I do with my journal entries from over the years, teen angst and all.
Notebook: github.com/brevdev/notebooks/...
Notebook to fine-tune on a HF dataset: github.com/brevdev/notebooks/...
My explanation on how QLoRA works: brev.dev/blog/how-qlora-works
Join the Discord: / discord
Find me on 𝕏: x.com/HarperSCarroll

Пікірлер: 95
@csmac3144a
@csmac3144a 6 ай бұрын
Just awesome! I never expected to encounter a fine-tuning video that had such a sweet human touch at the end :-). Keep up the great work and good luck with your venture!
@brev-dev
@brev-dev 5 ай бұрын
thank you so much for your kind words!!
@benbadman123
@benbadman123 7 ай бұрын
I didn't know it was physically possible to smile this much when debugging . My whole world has been rocked (dead serious). Thanks for the great tutorial!
@brev-dev
@brev-dev 7 ай бұрын
oh my goodness, this made my whole week 🥹 Thank you, Ben!
@benbadman123
@benbadman123 7 ай бұрын
Just came out of finals so am only seeing this now. Happy to hear it, hope the week was good!@@brev-dev
@justmalhar
@justmalhar 7 ай бұрын
I tried setting up the Brev instance. I’m already in love with the ease of setup & SPOT pricing 🙌🏻
@onoff5604
@onoff5604 8 ай бұрын
Wonderful video with a good level of detail and explanation (not just choppy soundbites). Hope you can make more. Many thanks!
@brev-dev
@brev-dev 8 ай бұрын
We plan to!!! So glad you enjoyed it, and thanks for the comment
@thegrumpydeveloper
@thegrumpydeveloper 8 ай бұрын
your explanation of rank and alpha was the most clear and concise I’ve heard. 🎉 tried reading about it and it’s always been a jumble.
@brev-dev
@brev-dev 8 ай бұрын
I love to hear it was helpful!! I'm so glad.
@geraldakorli
@geraldakorli 5 ай бұрын
Honestly never seen coders make programming look so fun.
@SethuIyer95
@SethuIyer95 8 ай бұрын
Pretty lucid explanation of the stuff involved. Thumbs up.
@elgoogtihstae
@elgoogtihstae 8 ай бұрын
I came here for a fine-tuning tutorial and I stayed for Harper ❤ cutest tutorial ever!
@brev-dev
@brev-dev 8 ай бұрын
aww, appreciate you! thanks for the sweet comment
@mysticaltech
@mysticaltech 4 ай бұрын
Yeah, I agree with other comments, very sweet. Your smile is contagious. I wanted to learn about fine-tuning, but found myself smiling lol. Two birds with one stone! Thank you.
@Arjay2186
@Arjay2186 8 ай бұрын
Awesome tutorial! Nice that you are explaining some of the things others would skip over (r & alpha for instance). Will try to teach Mistral understanding a new language (Danish) that way. Let's see how much it will take on 2 A10s.
@brev-dev
@brev-dev 8 ай бұрын
Appreciate your thoughtful feedback!!! How's your training going?
@captainflame8221
@captainflame8221 6 ай бұрын
please update us !!
@thenateo
@thenateo 5 ай бұрын
My god that output was adorable. Don't worry, I have plenty of journal entries just like that haha. Awesome vid.
@brev-dev
@brev-dev 5 ай бұрын
Aww haha, thank you. Appreciate your kind words.
@whiskeycalculus
@whiskeycalculus 7 ай бұрын
Hell yeah, can't wait to try brev
@kanizfatema9806
@kanizfatema9806 3 ай бұрын
please make a notebook for Llama 3 and this time show how the dataset example is formatted. the entire world would appreciated. Love you and your work.
@anshgangapurkar5253
@anshgangapurkar5253 8 ай бұрын
good shit gang, very useful
@Tarbard
@Tarbard 7 ай бұрын
Great video.
@enigmeta
@enigmeta 8 ай бұрын
Awesome video, thanks!
@brev-dev
@brev-dev 8 ай бұрын
So glad you enjoyed!
@lepron128
@lepron128 8 ай бұрын
thanks! i've been trying to find the correct format for the mistral datasets but i could only find very brief or technical information and the notebooks explaining how to train on your own dataset are almost non-existent. they all assume you intend to download the dataset from hf or use the vanilla models from HF. you've saved my life!
@brev-dev
@brev-dev 8 ай бұрын
SO happy to hear!! 😄😄
@endre777
@endre777 8 ай бұрын
Very cool and pragmatic tutorial. Inspired me to install and train my own M7b model. Would be great to share more video in this topic. Personally I would be curious to know more about different fine tuning methods and how to turn raw information to training data. Thanks for the effort and congrats for the content!
@brev-dev
@brev-dev 8 ай бұрын
Thanks for the suggestion, and so glad this worked for you! Appreciate your comment!
@jimhrelb2135
@jimhrelb2135 8 ай бұрын
This startup is so cozy
@crotonium
@crotonium 8 ай бұрын
You are indeed correct! FSDP is not needed for training with just a single GPU (assuming your model fits on a single GPU). It is a distributed training method which you use to accelerate your training.
@brev-dev
@brev-dev 8 ай бұрын
Thank you!! Yes yes-- I have that part just in case some users are using >1 GPU :) I just wasn't sure users would need it given that LoRA significantly reduces the trainable number of parameters however, I did have some users using >1 GPU have issues with parallelization - only 1 out of their 4 GPUs was being used, despite loading the accelerator and activating it, as my notebook does. I wasn't able to figure out why it didn't work. If you have any ideas, please do let me know!
@davidvaldebenito538
@davidvaldebenito538 8 ай бұрын
el mejor y mas agradable tutorial que he visto en los ultimos 700 años 😁😁😁😁😁
@brev-dev
@brev-dev 8 ай бұрын
jajaja muchas gracias!! me alegre que se ha ayudado😂🤗
@Tubby-oq3uu
@Tubby-oq3uu 7 ай бұрын
Honestly, I have never seen a tutorial made with so much positivity in my life before! You have a great personality for this stuff. I wish you and your partner the best with brev. God bless, Jesus love you.
@brev-dev
@brev-dev 6 ай бұрын
Thank you SO much for your beautiful words! I really appreciate it. God bless!
@truehighs7845
@truehighs7845 6 ай бұрын
@@brev-dev No seriously, I can't start to tell you what kind of help this is, I am just too busy learning to react more, but a fantastic job! (And get some shaving blades for this poor guy! :)))) PS2 Great job!
@DKTechYT
@DKTechYT 6 ай бұрын
I'm a bit confused on preparing the data. If I was to have a plain .txt file of a journal entry is all I need to do to prepare it just convert it to .jsonl? So for example I could have 150 entries of separate journal entries?
@terryliu3635
@terryliu3635 3 ай бұрын
Awesome video!! Thanks for sharing. I'm new to this field. Do you have any experience you could share regarding fine-tuning with structured data such as database tables?
@royjones1053
@royjones1053 8 ай бұрын
Hey, you have got me curious, been for a looksee through brev and keen to learn more of your offerings. Are you more active on some other platform or just KZfaq, guess I can find for myself but just being lazy. keen to hear more and especially what your future trajectory looks like for open source enthusiasts, mmmm or otherwise. Your a laugh a minute, don't edit that out ffs! Some laughs and a bit of dance is absolutely golden, a brief refresh and back into it is great! Can't be oh so serious all the time otherwise we wind up like the Joker😆
@brev-dev
@brev-dev 8 ай бұрын
Hey, thanks so much for your thoughtful feedback!! Appreciate it. So glad you like the laughs and the light-heartedness :) You can find me on X/Twitter!! www.x.com/harperscarroll - excited to have you onboard :)
@hungle2514
@hungle2514 7 ай бұрын
There are two versions of Mistral 7B. I dont know which one to use for my task: "Fine tuning the math dataset in order to improve the capability of answer elementary math questions". "mistralai/Mistral-7B-Instruct-v0.1" "mistralai/Mistral-7B-v0.1 Could you please tell me know. Thank you
@philtoa334
@philtoa334 8 ай бұрын
Very nice vidéo Thx .
@marekkedzierski6414
@marekkedzierski6414 7 ай бұрын
Thank you for this tutorial espiecially the notebook file. Let's say I would like to train the model with my own data related to my work. Let's say I will prepare series of questions and answers . How to prepare eval_dataset file? Can I use the same content as in train_dataset?
@adrianfiedler3520
@adrianfiedler3520 8 ай бұрын
5:18 best part :)
@geneanthony3421
@geneanthony3421 4 ай бұрын
The format for the output in JSON. Very popular format for data input/output and what most sites uses for backend calls. Not surprising you'd put it in this format.
@muhammadroifulanam3571
@muhammadroifulanam3571 3 ай бұрын
Can you show examples of samples for training and eval data?
@jamshikk95
@jamshikk95 4 ай бұрын
Can I use it on my m1 Mac pro ? Without any additional GPU thingy?
@thonnatigopi4962
@thonnatigopi4962 Ай бұрын
can i know how do we evaluate after finetuning the model, pls make a video of that
@mistercakes
@mistercakes 8 ай бұрын
is it possible to convert this new model to a GGUF file so that i can use it with ollama locally?
@KenMcCann
@KenMcCann 7 ай бұрын
@mistercakes did you get an answer to this?
@mistercakes
@mistercakes 7 ай бұрын
@@KenMcCann haven't received any private messages
@shakeelvohra
@shakeelvohra 4 ай бұрын
Also interested if anyone has some ideas
@HaoyangChen-of5pb
@HaoyangChen-of5pb Ай бұрын
Just wonder, is there any functions or platforms can help with the creation of my own dataset of local files?
@ThePositiev3x
@ThePositiev3x 4 ай бұрын
Just a little warning: When you split your set into two sets namely train and validation and skip the test set, in a possible future scenario you would be treating your validation set as your test set (because you did not split into 3 at the beginning). And this is a problem. Although the validation set is not used to change the model weights and thereby caused no data leakage, you're using the losses of validation data to change your hyperparameters such as number of layers, dropout etc. So what you're doing is trying to get the best result based on the losses of your validation set. Do you see what's happening? There's no data leakage, but you're imposing a leakage of a different kind, say, hyperparameter leakage (I just made that up). In a possible future scenario, your test set would be the one you used to tune your hyperparameters. The model could be performing nice with those data and hyperparameters combination but who can give a guarantee it performs not that good with different combination?
@brev-dev
@brev-dev 4 ай бұрын
In this case I don't ever plan to use a test set. If I did, I would definitely split into all 3 groups.
@shubhamgarg5007
@shubhamgarg5007 6 ай бұрын
11:50 Hey, I was wondering if the max_length can be any random multiple of 2 or is it restricted to a specific number? Lets say I have a dataset where each sample/note is 10k-15k tokens long. Can I set the max_length to 16384 in that case and expect the model to give decent results provided that I train it on enough data? I'd also like the model to have a good context window (preferrably 32k)
@tenzinrose
@tenzinrose 6 ай бұрын
Mistrals MoE has a 32k context window fyi
@shubhamgarg5007
@shubhamgarg5007 5 ай бұрын
@@tenzinroseYes, I am aware of that but I was asking if it can remain unchanged in the fine tuning as well
@arjunkshaji9738
@arjunkshaji9738 4 ай бұрын
Could you provide more information on why you chose to do padding = "left" because most examples seem to be using right padding. Also, it would help if you provided general guidelines on setting up the prompt for cases where we have more than 1 input along with instruction and a corresponding model response. For example, if we wanted the model to generate a response to an instruction like - create a short poem on topic "" in "". So while the instruction is common, the inputs and model response are say, 3 separate columns in the fine-tuning dataset. I hope I am making sense :)
@flashlin1
@flashlin1 6 ай бұрын
Excellent tutorial. I have numerous text files. How can I convert the content into a Q&A dataset? Are there any free and open-source converters available? Or is it necessary for a human to manually read through each text file and create the Q&A data one by one? Are there any specific guidelines for manually creating Q&A data?
@tenzinrose
@tenzinrose 6 ай бұрын
Use an LLM to create multiple questions per document then have an LLM answer those questions based on the doc. Boom, Q/A pairs.
@flashlin1
@flashlin1 6 ай бұрын
@@tenzinrose Using the same LLM, instructing it to read a very large document, and then generating several questions followed by producing answers one by one. Throughout this process, human manual review of each answer content is still required. Isn't this essentially a chicken-and-egg problem? Furthermore, the document is extremely extensive and cannot be summarized into a few key points. For LLM, with a length constraint of only 4096, And it's not possible to simply solve it by straightforwardly dividing based on length. Is there a smarter solution?
@mldlcvforlayman7745
@mldlcvforlayman7745 6 ай бұрын
Can you please share notes.jsonl and evaluation.jsonl files?
@rraul
@rraul 8 ай бұрын
hello, please do a video how to make rag on zephyr gptq. all gpu poors need this. thank you!
@DannyGerst
@DannyGerst 8 ай бұрын
Can you explain the step with the dataset again. You only told you will not show because it is private, but a sample would me nice. So you are not creating questions / answer pairs?
@brev-dev
@brev-dev 8 ай бұрын
Ah sorry if that was confusing! I actually do show how the data was formatted and explained from 1:30 - 2:45. It was the jsonl file where each line contained a note in map form: {"note": "full-note"}
@s4mw00
@s4mw00 7 ай бұрын
@@brev-dev What about the validation file? I think you said you split your notes into two files (80/20) and.... that's it?
@brev-dev
@brev-dev 7 ай бұрын
That is the validation set! We don’t use a final test set. @@s4mw00
@mohammedmujtabaahmed490
@mohammedmujtabaahmed490 4 ай бұрын
is the process same for llama 2 as well?
@xi8t-gk1oi
@xi8t-gk1oi 6 ай бұрын
I don't even understand why there are notes_validation.jsonl. As no example of notes were shown in this video it is hard to understand what is what for a beginner. I imagined something like you just feed with notes that you want to save and just train on that data to respond accordingly. What is validation data? Is it like if I saved to my iPhone notes that sun is yellow and first entry in notes.jsonl is "The sun is yellow" but notes_validation.jsonl? Do I have to put the same entry in notes_validation.jsonl "The sun is yellow"?
@korayem
@korayem 8 ай бұрын
Amazing! Can this work on books? Did you try it?
@brev-dev
@brev-dev 8 ай бұрын
It likely can! You just need the text from the book in the right format
@korayem
@korayem 8 ай бұрын
@@brev-dev need to try that Thanks a ton for the video
@shatler
@shatler 4 ай бұрын
Where do I get the notes.jsonl file?
@rautsanket4086
@rautsanket4086 8 ай бұрын
Excellant tutorial I have a pdfs data i just want to train a question answer model on my pdf's. questions are common but answers will be vary as per pdf changes Also how to make dataset to train that type of model. how can i develop by using mistral Explain in detail
@-iIIiiiiiIiiiiIIIiiIi-
@-iIIiiiiiIiiiiIIIiiIi- 7 ай бұрын
Ohhhh she got that jungle fever.
@abdullahsulaymaan9085
@abdullahsulaymaan9085 8 ай бұрын
i dont have any background in CS and need some help and guidance if anyone is willing to support me. can this work in other formats, for example: { "source": "social media", "input": [ "Thank you " ], "output": [ "I told him, he is in the chat Rn " ], "response_time": 60.0 (
@EashanKotha
@EashanKotha 9 ай бұрын
Excited to watch this while I eat lunch later 🤌
@brev-dev
@brev-dev 8 ай бұрын
woooo! let us know how it goes!
@royjones1053
@royjones1053 8 ай бұрын
oh yeah, tell them to get you a better mic or/and and driver. So tomorrow at the Brev Morning meeting (if you have one) be sure to remember that "hey I need a better mic, I got given shit on KZfaq for having shitty sound, other than that they loved it". Looking forward to the next installment!
@fvredits2283
@fvredits2283 3 ай бұрын
Hello, there is a channel called "1littlecoder" that has reuploaded your video, I'm wondering if he had permission to do so
@yeduniya657
@yeduniya657 6 ай бұрын
Hey, I am very passionate about llms and wanted to assemble a dataset of my own writings and that of my enlightened gurus. I am technically unsophesticated for this task so I request you to help me out. Will you please train a model in a similar fashion on the dataset that I provide you? (like how you do in this tutorial)
@IAmCandal
@IAmCandal 6 ай бұрын
this was so silly. 604 more comments and we will have reached our goal!
@francois-xavierpozin2589
@francois-xavierpozin2589 3 ай бұрын
Hello, I find your tutorial very interesting but I don't understand everything... my English, sorry, leaves something to be desired! So if you're looking for an idea to improve your tutorial, it would be nice to activate the subtitles, because when I read it's already much better. If you also activated the other languages that would be great! You understand, this isn't a criticism in any way, it's just that I want to make sure I've understood correctly. Otherwise, you probably know that the Mistral is a strong wind from the South of France... The old Provençals say it's a wind that drives you crazy and lasts 3, 6 or 9 days. Have a nice weekend
@GerryPrompt
@GerryPrompt 3 ай бұрын
Wow they only have 4K subs? Is this supposed to be a joke?
@CustomDabber360
@CustomDabber360 7 ай бұрын
satan !
@lewingtonn
@lewingtonn 6 ай бұрын
this is cringe
@lewingtonn
@lewingtonn 6 ай бұрын
but thanks for the walkthrough
@ragoonsgg589
@ragoonsgg589 4 ай бұрын
....wat
@elpablitorodriguezharrera
@elpablitorodriguezharrera 6 ай бұрын
Can you make your face appears larger on video? I mean, you're so cute, I even forgot what I'm searching here on yt
@AmitKumar-fn8px
@AmitKumar-fn8px 3 ай бұрын
if you could've showed the sample format of notes.jsonl and notes_validateion.jsonl, it would've really helped, it' really confusing
QLoRA-How to Fine-tune an LLM on a Single GPU (w/ Python Code)
36:58
КАК ДУМАЕТЕ КТО ВЫЙГРАЕТ😂
00:29
МЯТНАЯ ФАНТА
Рет қаралды 8 МЛН
I Can't Believe We Did This...
00:38
Stokes Twins
Рет қаралды 116 МЛН
- А что в креме? - Это кАкАооо! #КондитерДети
00:24
Телеканал ПЯТНИЦА
Рет қаралды 7 МЛН
Double Stacked Pizza @Lionfield @ChefRush
00:33
albert_cancook
Рет қаралды 35 МЛН
Master Fine-Tuning Mistral AI Models with Official Mistral-FineTune Package
23:32
10 weird algorithms
9:06
Fireship
Рет қаралды 1,1 МЛН
🐐Llama 3 Fine-Tune with RLHF [Free Colab 👇🏽]
14:30
Whispering AI
Рет қаралды 14 М.
"okay, but I want Llama 3 for my specific use case" - Here's how
24:20
Fine-tuning Large Language Models (LLMs) | w/ Example Code
28:18
Shaw Talebi
Рет қаралды 274 М.
LLAMA-3 🦙: EASIET WAY To FINE-TUNE ON YOUR DATA 🙌
15:17
Prompt Engineering
Рет қаралды 63 М.
How To Fine-tune LLaVA Model (From Your Laptop!)
16:47
Fine-tune Mixtral 8x7B (MoE) on Custom Data - Step by Step Guide
19:20
Prompt Engineering
Рет қаралды 36 М.
КАК ДУМАЕТЕ КТО ВЫЙГРАЕТ😂
00:29
МЯТНАЯ ФАНТА
Рет қаралды 8 МЛН