Training BERT #4 - Train With Next Sentence Prediction (NSP)

  Рет қаралды 9,121

James Briggs

James Briggs

Күн бұрын

Next sentence prediction (NSP) is one-half of the training process behind the BERT model (the other being masked-language modeling - MLM).
Although NSP (and MLM) are used to pre-train BERT models, we can use these exact methods to further pre-train our models to better understand the specific style of language in our own use cases.
So, in this video, we'll cover exactly how we take an unstructured body of text, and use it to pre-train a BERT model using NSP.
Meditations data:
github.com/jam...
Jupyter Notebook
github.com/jam...
🤖 70% Discount on the NLP With Transformers in Python course:
bit.ly/3DFvvY5
📙 Medium article:
towardsdatasci...
🎉 Sign-up For New Articles Every Week on Medium!
/ membership
📖 If membership is too expensive - here's a free link:
towardsdatasci...
🕹️ Free AI-Powered Code Refactoring with Sourcery:
sourcery.ai/?u...

Пікірлер: 29
@sinabd1396
@sinabd1396 Ай бұрын
Even after 3 years I haven't found such an amazing, easy to follow tutorial series on this topic. I really loved it James. Thank you!❤
@goelnikhils
@goelnikhils Жыл бұрын
Amazing Video. Amazing Explanation with so much ease.
@niteshmethani9884
@niteshmethani9884 2 жыл бұрын
Amazing video, James. It's just what I was looking for. Bought your course on udemy just to learn from you.
@jamesbriggs
@jamesbriggs 2 жыл бұрын
that's awesome, happy to have you here!
@anshoom
@anshoom 2 жыл бұрын
@James Briggs superb job with the explanation, your voice is very soothing as well, kept me focused+awake while watching, ha ha! Curious if it matters to do MLM and NSP training in any particular chronology? In a separate context, should you have insight, I am trying to pre-train on my corpus for sentence embeddings, does both stages of training are still required or just MLM is enough ? Thank you!
@basharmohammad5353
@basharmohammad5353 3 жыл бұрын
Thanks for the nice video. Really helpful!
@mohamadrezabidgoli8102
@mohamadrezabidgoli8102 3 жыл бұрын
Hi James, Thanks again for the high quality content you are making. Can you also make a video for using (and fine-tuning) BERT for binary classification problems (like say sentiment analysis or machine-generated determination)?
@jamesbriggs
@jamesbriggs 3 жыл бұрын
hey just saw your comments - will definitely add it to the list, I think you already found one on Bert for classifications, there's also this one: kzbin.info/www/bejne/ppvXn555fKqfmac Which includes the saving/loading of your model at the end too I haven't heard of machine-generated determination before, do you have any links to articles/videos on it? Could be interesting to look into...
@sxmirzaei
@sxmirzaei 2 жыл бұрын
Hi James, thanks for the video! How do you save the model, load and use it for prediction? none of the videos in the playlist cover it. Thanks!
@Wigglebus
@Wigglebus 2 жыл бұрын
Hi, great video. Could you also explain or show how to make predictions with this model?
@d3v487
@d3v487 3 жыл бұрын
Amazing Guide Love it💗. Very intuitive Explanation🧠. I find out that there are not that many good resources about Text Summarization and fine-tuning it. Please Upload a Video of Fine-tuning Text Summarization model on a dataset using Huggingface Transformers. It'll be very helpful for every NLP Practitioner. Love From India❤️🙏🏻.
@jamesbriggs
@jamesbriggs 3 жыл бұрын
That would be awesome, will add it to the list!
@sinamon6296
@sinamon6296 3 жыл бұрын
Very helpful. Thank you ! subscribed :)
@jamesbriggs
@jamesbriggs 3 жыл бұрын
Awesome, thankyou!
@intoeleven
@intoeleven 3 жыл бұрын
Thanks for providing this wonderful course! Wonder where is this jupyter notebook?
@jamesbriggs
@jamesbriggs 3 жыл бұрын
Added to video description :)
@sabrinabani7973
@sabrinabani7973 Жыл бұрын
If I have several paragraphs and want to see if they are consecutive or not, how do I write label =0 or label =1?
@vijayendrasdm
@vijayendrasdm 3 жыл бұрын
Hi James Great video again.!! Please clarify We are creating just a pair of data/record i.e sent_a, sent_b, label from one paragraph . Suppose a paragraph has 10 sentences , shouldnt we come up with more records ( , ) from same paragraph
@jamesbriggs
@jamesbriggs 3 жыл бұрын
ideally yes if you have plenty of sentences, we can also do paragraph 1 followed by paragraph 2, etc (doesn't need to be 'sentences' specifically, just as long as there is some sort of topic continuity between the two), the code here is written to be as simple as possible though :)
@vijayendrasdm
@vijayendrasdm 3 жыл бұрын
@@jamesbriggs thanks James
@TO-il3vc
@TO-il3vc Жыл бұрын
wouldnt it be important to make sure the random sentence for sentence B doesnt end up being the TRUE next sentence? I implemented a simple while loop to check if that is the case, before appending to sentence_b list.
@jamesbriggs
@jamesbriggs Жыл бұрын
Yeah you can add that in. I don’t here is to keep the example as simple as possible, and with a large dataset the actual impact on performance would be minor due to the (probable) low number of times this happens
@abdallahmahmoud8642
@abdallahmahmoud8642 2 жыл бұрын
Hey James, thanks a lot for the information. I have a question when you have time, I currently have a pre-trained model using BertForMaskedLM, my goal is to fine-tune it with BertForNextSentencePrediction. How should one go about it? Also I might be able to transfer the weights to BertForPretraining and fine tune it there. Is that correct? Thanks!
@jamesbriggs
@jamesbriggs 2 жыл бұрын
hey Tito! you should be able to save the MLM model with save_pretrained('path/to/model ') and then you should: ``` from transformers import BertForNextSentencePrediction model = BertForNextSentencePrediction.from_pretrained('path/to/model') ```
@abdallahmahmoud8642
@abdallahmahmoud8642 2 жыл бұрын
Thanks a alot, this was really useful
Training BERT #5 - Training With BertForPretraining
21:46
James Briggs
Рет қаралды 13 М.
Training BERT #1 - Masked-Language Modeling (MLM)
16:24
James Briggs
Рет қаралды 32 М.
How Strong is Tin Foil? 💪
00:26
Preston
Рет қаралды 142 МЛН
OYUNCAK MİKROFON İLE TRAFİK LAMBASINI DEĞİŞTİRDİ 😱
00:17
Melih Taşçı
Рет қаралды 13 МЛН
Good teacher wows kids with practical examples #shorts
00:32
I migliori trucchetti di Fabiosa
Рет қаралды 4 МЛН
Training BERT #2 - Train With Masked-Language Modeling (MLM)
27:46
James Briggs
Рет қаралды 20 М.
BERT Research - Ep. 3 - Fine Tuning - p.1
32:04
ChrisMcCormickAI
Рет қаралды 81 М.
HuggingFace Crash Course - Sentiment Analysis, Model Hub, Fine Tuning
38:12
Has Generative AI Already Peaked? - Computerphile
12:48
Computerphile
Рет қаралды 997 М.
BERT: transfer learning for NLP
13:45
Lennart Svensson
Рет қаралды 10 М.
How Strong is Tin Foil? 💪
00:26
Preston
Рет қаралды 142 МЛН