Applying BERT to Question Answering (SQuAD v1.1)

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

ChrisMcCormickAI

ChrisMcCormickAI

Күн бұрын

Пікірлер: 113
@terrortalkhorror
@terrortalkhorror 5 ай бұрын
I am a master's student at Columbia. Your explanation is so much better that the explanation that I had from my faculty. Keep doing what you are doing
@adammonroe378
@adammonroe378 3 ай бұрын
One of the greatest explanation for QA I have ever seen! There are lots of garbage and confusing explanations in Huggingface. But you are the hero!
@vkieuvongngam
@vkieuvongngam 4 жыл бұрын
Thank you for the video + colab. By far this is the clearest, most practical tutorial I have seen. Hope you can show how to fine-tune the model!
@ChrisMcCormickAI
@ChrisMcCormickAI 4 жыл бұрын
Thanks, Virapat! I plan to publish a fine-tuning Notebook on that topic in the coming month or so, I'll let you know when it's up!
@Gokulhraj
@Gokulhraj Жыл бұрын
@@ChrisMcCormickAI is fine tuning video published?
@MrSubbunsb
@MrSubbunsb 4 жыл бұрын
This is awesome work Chris. Thanks for taking your time out to share your research and knowledge in such a detailed manner. I really appreciate it.
@ChrisMcCormickAI
@ChrisMcCormickAI 4 жыл бұрын
My pleasure!
@jamiekhoo875
@jamiekhoo875 2 жыл бұрын
Thank you so much for saving me in this NLP chapter!
@sahibsingh1563
@sahibsingh1563 4 жыл бұрын
Eagerly waiting for Next video on Question Answering Video Awesome work buddy
@praveentayal2127
@praveentayal2127 4 жыл бұрын
Great explanation Chris. It is very impressive to see how you discuss everything in the simple but very effective way. Thanks a lot. I have a request if you could do a video on cloze style QA model using fine tuning approach. Cloze style is like fill in the blanks.
@amanjain9418
@amanjain9418 11 ай бұрын
you are doing a great work, it has helped me a lot. can you please make a video on how to generate questions from a given paragraph using bert
@gokuldas027
@gokuldas027 4 жыл бұрын
"What are some example applications of BERT?" "question answering and language inference" Ohh, it is self-aware..😝 Thanks for the video, this is great.
@ChrisMcCormickAI
@ChrisMcCormickAI 4 жыл бұрын
Right?! 😂 Thanks for the encouragement!
@jean-baptistedelabroise5391
@jean-baptistedelabroise5391 3 жыл бұрын
hmm I would have tried "what can I use you for" to see if BERT knows it is named BERT
@DeaMikan
@DeaMikan 4 жыл бұрын
Chris you explain these concepts extremely well! Thank you. Would love to see some new videos. An idea: what if we instead generate a question from a passage given an answer?
@aartirao1466
@aartirao1466 4 жыл бұрын
This was very well explained and very helpful! Thank you!!
@sujatadas8524
@sujatadas8524 3 жыл бұрын
It is become very helpful for us. Thank you for such video. Please keep continue such type of research videos. :-)
@левасемин
@левасемин 3 жыл бұрын
I had a problem with answer_start and answer_end, the solving is outputs = model(....) start_scores = outputs.start_logits end_scores = outputs.end_logits
@ChrisMcCormickAI
@ChrisMcCormickAI 3 жыл бұрын
Sorry about this! The transformers library interface changed and slightly broke my code. I've since updated the Notebook to fix it.
@goelnikhils
@goelnikhils Жыл бұрын
Hi Chris, Great Content. One question - How does BERT recognizes start token and end token.
@connor-shorten
@connor-shorten 4 жыл бұрын
Thanks Chris, really helpful!
@aiplaygroundchannel
@aiplaygroundchannel 4 жыл бұрын
Do you know how to perform this task without user BertForQuestionAnswering? In other words how to apply question answer to a simple BertModel or AutoModel?
@parvashah3776
@parvashah3776 4 жыл бұрын
Great video, mate. Please dedicate a video for Slot Filling and Intent Detection using BERT in the future.
@prayankkulshrestha2492
@prayankkulshrestha2492 4 жыл бұрын
Well Explained Sir !!!! I have one query. if we have a Sequence length more than 512, then how to deal with this problem. Somewhere I heard that strides can help in that problem.
@dhruvshah8577
@dhruvshah8577 4 жыл бұрын
Fantastic video Chris for learning how to get the own QA model reference to SQUAD1.1 . Are u by any chance working with SQUAD 2.0 data set ?
@ChrisMcCormickAI
@ChrisMcCormickAI 4 жыл бұрын
Thanks, Dhruv! I haven't dug into 2.0 yet, but I'd definitely like to. Being able to say when a reference text *doesn't include the answer* seems pretty key for a real system! Thanks for letting me know you're interested!
@ishanjain711
@ishanjain711 Жыл бұрын
there can be question which have multiple answers like "what are benefits of bert" but this only gives one answer how can we generate all answers ?
@putrikamaluddin6595
@putrikamaluddin6595 4 ай бұрын
hi Chris, given i have news dataset, is there any parameters in the model, that i can fine tune it? so i can train and test it?
@deepaksingh9318
@deepaksingh9318 4 жыл бұрын
Very help and nicely explained video. But how to tackle the situation if we have > 512 tokens in a sentence , and i dont want to short or cut it because it might lose the information i am looking for .. So is there parameters or technique which can handle this ?
@ChrisMcCormickAI
@ChrisMcCormickAI 4 жыл бұрын
Hi deepak, that’s a good question. I haven’t dug into that, so I might not be the best resource. One thought, though--I know that SQuAD v. 2 includes “answer not found in text” as a possible output. I think this implies, then, that you could scan BERT over the document in chunks, and hopefully BERT will say “not found” in all of the chunks except for the correct one. Let me know what you figure out! Thanks, Chris
@deepaksingh9318
@deepaksingh9318 4 жыл бұрын
@@ChrisMcCormickAI Thanks Chris.. Will surely explore that too.. 🙂 And thanks for creating the Bert Series, this really helped me in one of my NLP project.. 👍 Hoping to see more in future..
@saumyasharma8511
@saumyasharma8511 7 ай бұрын
so start must be a vector then of the same dimension as the dimension of the final output from encoder ?
@teetanrobotics5363
@teetanrobotics5363 3 жыл бұрын
Could you please add all the remaining BERT videos to the BERT playlist ?
@simonnick1585
@simonnick1585 4 жыл бұрын
Fantastic job again. Keep it going!
@aritradas424
@aritradas424 3 жыл бұрын
Just curious, can we create a model that will generate the answer to the question and not find the answer in the context?
@AnkitMishra-hd5uu
@AnkitMishra-hd5uu 7 ай бұрын
I m unable to get data, can anyone share the link of SQuad dataset
@abhimalyachowdhury7835
@abhimalyachowdhury7835 3 жыл бұрын
I am getting error when I run your colab notebook...In cell 11, start_scores is obtained as a string from the model, Hence I am getting error in the next cells. When I printed out start_scores, it says 'start_logits'
@ChrisMcCormickAI
@ChrisMcCormickAI 3 жыл бұрын
Hi Abhimalya, sorry about that error (and for taking so long to get back to you!). The transformers library made a change that broke compatibility with my example code. I've fixed the Notebook.
@abhimalyachowdhury7835
@abhimalyachowdhury7835 3 жыл бұрын
@@ChrisMcCormickAI yeah..I fixed it too by using the parameter return_dict=False
@blackthirt33n
@blackthirt33n 2 жыл бұрын
how would you move this from a collabera note book to python script and then expand the work?
@ShreyasKulkarni
@ShreyasKulkarni 4 жыл бұрын
Thanks for this great series!! Can you explain applying BERT on the Natural Questions Dataset from Google? It is more difficult than SQuAD and I want to understand how to preprocess it for BERT
@ChrisMcCormickAI
@ChrisMcCormickAI 4 жыл бұрын
Hi Shreyas, thank you! That sounds interesting--do you know what constitutes an "answer" in that dataset? Is it also just identifying a span of text in a reference text? Thanks!
@ShreyasKulkarni
@ShreyasKulkarni 4 жыл бұрын
@@ChrisMcCormickAI The paper describes an "answer" to be of two types long and short. The long answer is a span of text from the reference wikipedia page containing all the information to infer the answer and the short answer is one or more entities that give a short answer to the question, or a boolean 'yes' or 'no'. Both long and short answers can be 'NULL' if no viable answer is found. Google has launched a competition for this dataset which gives a nice visualisation of the task - ai.google.com/research/NaturalQuestions/visualization
@ChrisMcCormickAI
@ChrisMcCormickAI 4 жыл бұрын
@@ShreyasKulkarni Interesting, thanks! Seems like you might need to come up with a different output layer for BERT, and probably modify the cost function, in order to apply it to that task. I’ll let you know if I get a chance to play with it!
@ShreyasKulkarni
@ShreyasKulkarni 4 жыл бұрын
@@ChrisMcCormickAI Yes there are a few papers which provide solutions and explain the top layer for BERT but I haven't found a resource about preprocessing the dataset so I am bit stuck there. Again thanks for these videos they have helped a lot! Keep it up!
@sujatadas8524
@sujatadas8524 3 жыл бұрын
Need one help. It says the model is working for 512 tokens. How can we apply it for large tokens (ex. 3000 tokens)?? Please help. Thanks in advance.
@andregodinho3621
@andregodinho3621 4 жыл бұрын
How about words in the middle of the span? I didn't understand very well how does BERT predicts words in the answer without being the start or the end of the span/sentence.
@sumant1937
@sumant1937 4 жыл бұрын
Your tutorials are very good. Please do a tutorial on bert from scratch using transformers library.
@shivangisrivastava9839
@shivangisrivastava9839 3 жыл бұрын
How you calculated the start and end score for the answer. I mean how vector product is taken how Softmax activation layer is applied.
@ShortVine
@ShortVine 4 жыл бұрын
Thank you so much for this. Can you please make same type of vid on ALBERTA or ROBERTA?
@georgekokkinakis7288
@georgekokkinakis7288 4 жыл бұрын
Great video. Can you please show how to fine tune on custom QA data set?
@namanjaswani8925
@namanjaswani8925 4 жыл бұрын
Great content. Really enjoyed it !!!
@chuanjiang6931
@chuanjiang6931 4 жыл бұрын
Hi Chris, do you have a video for sentence semantic similarity?
@nawazsheikh19
@nawazsheikh19 3 жыл бұрын
This is great. Thank you 👍
@arindammondal9364
@arindammondal9364 3 жыл бұрын
Hey Chris, Thanks for the wonderful explanation. I got an error while running - start_index =torch.argmax(start_scores) end_index = torch.argmax(end_scores) answer = ' '.join(tokens[start_index:end_index+1]) TypeError: argmax(): argument 'input' (position 1) must be Tensor, not str Can you please look over it?
@BiranchiNarayanNayak
@BiranchiNarayanNayak 4 жыл бұрын
How can i pre-train BERT for Question Answering on a different language ? I want to use for Malay language.
@deepaksingh9318
@deepaksingh9318 3 жыл бұрын
Hi Chris I just observed a random behavior of BERT hwere where it gives different answers with everytime for same piece oh phrase ans same question. ... Any idea which parameter can i change to change this behavior, or this any line where i can set some seed etc?
@trongnguyenquoc2940
@trongnguyenquoc2940 4 жыл бұрын
thank you so much
@ChrisMcCormickAI
@ChrisMcCormickAI 4 жыл бұрын
You're welcome!
@jyothilakshmikrishnakumar9398
@jyothilakshmikrishnakumar9398 4 жыл бұрын
Great Video!!Thank you so much. I am working with squad dataset. How to use this padding argument and batch token the whole data. Kindly help!!
@anaghajose691
@anaghajose691 4 жыл бұрын
Sir,how to do BERT Embedding using a dataset downloaded from Stanford
@sarthakkagliwal5010
@sarthakkagliwal5010 4 жыл бұрын
can u make some videos on applications of GPT-2/GPT-3?
@wiama
@wiama 4 жыл бұрын
Thank you so much for this. I want to build a QA system in my language (Indonesia) but I couldn't find any pre-trained model for this, I tried using the BERT multilingual but can't be ised for initializing BertForQuestionAnswering, could you please help pointing me to the right direction in order to do this?
@BomDia.Filho_
@BomDia.Filho_ 4 жыл бұрын
can any one help me? I'm trying for months now to use BERT in portuguese, but I cant. Can I use this code to use the portuguese version of BERT?
@meacedric2328
@meacedric2328 4 жыл бұрын
Thank you for this video. Very great ! Can you (or anyone who knows) explain me how the question part of the sentence is take into account in the prediction phase ? Thank you !
@RajeevMishraYT
@RajeevMishraYT 3 жыл бұрын
Hey @Chrish, Thanks for this awesome video. Completed your BERT series in 1 go. You have explained in a super easy way. I have been going through the Colab Notebook that you attached, I was getting error at the end part where we combine Start & End score and we apply Argmax to get word with max probability, I was getting error with this code "answer_start = torch.argmax(start_scores)" The error was== TypeError: argmax(): argument 'input' (position 1) must be Tensor, not str ,,,, I tried to look at Huggingface Documentation but didn't get much help. The error says we are giving "start_scores" as a string, however, I cross checked our model output is start_logits & end_logits respectively. Can you check on this? Thanks, Rajeev
@wanhongzhi7395
@wanhongzhi7395 3 жыл бұрын
where is the code?
@xumingwang1255
@xumingwang1255 4 жыл бұрын
Amazing Wednesday!
@romanweilguny3415
@romanweilguny3415 4 жыл бұрын
Thx for this video. I never tried to use BERT before, and I have a question. A friend of mine wrote a small book and I am wondering if one can use this BERT model to play the question/answer game about the content of his book. Is it possible to not only use a paragraph as answer input but let's say 30 pages of text? How about the performance?
@ChrisMcCormickAI
@ChrisMcCormickAI 4 жыл бұрын
Hi Roman, that's a good question--certainly any practical QA system would need to be able to handle longer reference texts. I'm sure people have worked on solutions to that problem, but I'm not acquainted with the topic enough to point you to a good one. I'd love to build a similar system at some point, so if I do any more research on it I'll let you know!
@cosmogyral2370
@cosmogyral2370 2 жыл бұрын
How would you evaluate the model?
@nickryan368
@nickryan368 2 жыл бұрын
Hi Cosmo, you can use the SQuAD dataset test set (or any other question answering dataset) to test your model. SQuAD is typically evaluated with the F1 or EM (exact match) metrics.
@adithyav8611
@adithyav8611 4 жыл бұрын
Can you say something about what to do if the answer_text is larger than 512 tokens? For instance if it is a few pages? Thanks!!
@umareddy213
@umareddy213 4 жыл бұрын
Do you got any answer for this...tokens
@GodWesBrown
@GodWesBrown 4 жыл бұрын
can we create a question answering system using Race dataset? but it is a MC comprehension questions database...
@ChrisMcCormickAI
@ChrisMcCormickAI 4 жыл бұрын
Hi Charles - Yes, it's definitely possible--I'm seeing that XLNet was applied to it, so presumably BERT can be as well. At a glance, RACE appears to have two types of questions: fill-in-the blank (which can be handled by BERT's masked language model), and multiple choice (which I'm thinking you could apply a sentence-pair classifier to).
@adithyav8611
@adithyav8611 4 жыл бұрын
Thank you!!
@NPCvsNPC
@NPCvsNPC 4 жыл бұрын
Thank you very much for your work. I have a question.
@shivangisrivastava9839
@shivangisrivastava9839 3 жыл бұрын
How I can contact you?
@ChrisMcCormickAI
@ChrisMcCormickAI 3 жыл бұрын
You can contact us at team@chrismccormick.ai
@abhishekprakash9803
@abhishekprakash9803 2 жыл бұрын
helo i don't think this model is good, that supports factoid answers, i want this model that generate atleast one,two line sentences..........as an answers..............not in single sentences,not in some word i want answers more than 2 ,3 sentences, how we do hat any ideas?
@nickryan368
@nickryan368 2 жыл бұрын
Hi Abhishek, I think there are two distinctions that can help you figure out what model will be best for your application. The first distinction is between extractive question answering vs. generative question answering. Extractive means we are just searching for a span in the reference document that is a good answer to our question, while generative question answering models will use some kind of text generation model like a decoder stack to answer the question word by word in sequences that might not exist in the reference documents. The second distinction is between short and long answer datasets. How long your model's answers are will depend on how it was designed and on what kind of datasets it was trained. SQuAD is a short answer dataset, so it's designed to train models to provide short answers. If you take a look at a datset like NaturalQuestions from Google, this dataset is split into both a long answer and a short answer format, so you could train a model on the long answer format. So, it sounds like you should take a look at question answering datasets that have long answer formats. As for extractive vs. text generation models, this somewhat depends on what your target data looks like. Extractive models have the advantage of retrieving grammatically and factually correct answers, but they face obvious limitations if the answers aren't clearly contained in the reference documents. Text generation models are able to stitch together multiple facts to produce an answer, but can suffer from producing nonsense answers, ungrammatical sentences, etc. A model like RAG would be an easy place to start for a text generation model (we have videos and tutorials to get RAG running). You could try an extractive approach with something like RoBERTA trained on long form answers and see if it suits your needs. Good luck!
@Gkrmabggjhlb-dh8kg
@Gkrmabggjhlb-dh8kg 4 жыл бұрын
Thanks Chris, Excellent BERT QA explanation . Please share your email or LinkedIn details . Waiting for your response.
@강병하-g9v
@강병하-g9v 4 жыл бұрын
Thank you for the video! I want to fine-tune with my customized QA dataset using BERT-QA then how can i fine-tune it?
@VijayMauryavm
@VijayMauryavm 4 жыл бұрын
Thank you so much
@yiwei7278
@yiwei7278 2 жыл бұрын
900th like : )))
@The46014601
@The46014601 4 жыл бұрын
The video is great. Could you do Bert For Multiple Choice ? I have no idea how to do it.
@dardodel
@dardodel 4 жыл бұрын
Thanks Chris. Such a neat, to-the-point, and informative video on BERT QA.
@shivangisrivastava9839
@shivangisrivastava9839 3 жыл бұрын
Does this code also works on SQuAD 2.0 Dataset?
@samuellee1121
@samuellee1121 3 жыл бұрын
How about MC question?
@vbvaibhav17
@vbvaibhav17 4 жыл бұрын
Hello Sir, Thank you for this video. I want to ask can you please try this project with tensorflow hub also, it would be very grateful
@ChrisMcCormickAI
@ChrisMcCormickAI 4 жыл бұрын
Hi Vaibhav! It would be cool to create a TF version... I'll add it to the list :)
@mariusjohan5054
@mariusjohan5054 4 жыл бұрын
Huggingface also added a tf version, github.com/huggingface/transformers/blob/master/src/transformers/modeling_tf_bert.py, but you should write the processing yourself if you also want that as tensorflow
@vbvaibhav17
@vbvaibhav17 4 жыл бұрын
@@ChrisMcCormickAI ty sir
@vbvaibhav17
@vbvaibhav17 4 жыл бұрын
@@mariusjohan5054 ty buddy
@naveen6630
@naveen6630 3 жыл бұрын
Hey Chris! It's great you've made a playlist on BERT. Actually, I have an idea of working with BERT using Flask(farm-haystack). Is it similar to the one you have made, if not, could you share your knowledge on that with me?. Thank you.
@jeffreymonsalve5574
@jeffreymonsalve5574 4 жыл бұрын
Great video! If you have a domain specific dataset should use transfer learning on BERT? Will the Question/Answering mechanism will improve? Thanks!
@sehamrashed7449
@sehamrashed7449 4 жыл бұрын
Thank you so much for all of bert series it was very clear, and organized. can you please tell me why you excluded SQUAD v2 from this task? is there any difference on implementation, just i want high level explanation for now . does they have difference during building the model for qa task?
@CloudTheColdest
@CloudTheColdest 3 жыл бұрын
Thanks, very clear and understandable. Just a couple of questions: - If I understand correctly a Question Answering system is NOT able to generate words that is not explicitly written in the text, correct? E.g. if the reference text is "The wife of John Doe is dead", the answer to the question "Which is the marriage status of John Doe?" cannot be "widow", since this word "widow" does not appear in the reference text, is that correct? - Is it possible for a QA system to answer to a yes/no question? In the previous example, can I ask "Is the wife of Jon Doe dead?" and expect "yes" as answer? From that I understand, this should be impossible as well, for the same reason I pointed out above, correct? Thanks a lot and sorry for the long comment
@innocentaroh9179
@innocentaroh9179 4 жыл бұрын
Hi Chris, that's a good presentation, thank you. I couldn't access the notebook with the link above, it's giving me an error message.
@kirillgerasimov262
@kirillgerasimov262 4 жыл бұрын
Hi Chris! Great video. One small question. How to ensure that the dictionary ('bert-large-uncased-whole-word-masking-finetuned-squad') is consistent with the model ?
@chuanjiang6931
@chuanjiang6931 4 жыл бұрын
Thanks for taking me here Chris. That is really GREAT video!!! Really appreciated it!! I got the idea of this video, and to me this pre-trained model is like a magic black box. It can do amazing job but i really do not know how to fine tune one myself. So my question is that if I would like to develop a QA model for a different domain, how necessary do you think we should fine tune a new one ourselves or a pre-trained model like 'bert-large-uncased-whole-word-masking-finetuned-squad' is sufficient?
@chuanjiang6931
@chuanjiang6931 3 жыл бұрын
Thanks Chris, can you make another video for QA using squad 2.0?
@JuantheJohn1
@JuantheJohn1 2 жыл бұрын
Do you have the link with the code? Thanks!
@nickryan368
@nickryan368 2 жыл бұрын
Hi Juan, the link to the notebook is in the youtube description :)
@sandipsarkar5394
@sandipsarkar5394 4 жыл бұрын
Can you please send me the github link of your code?
@arsyamohamedali8623
@arsyamohamedali8623 4 жыл бұрын
Hi How to deploy bert model in Android studio?
@sepideh83
@sepideh83 4 жыл бұрын
Super helpful. Thank you so much.
@julessci2716
@julessci2716 3 жыл бұрын
Very clear explanations.
@Jason-iq9pe
@Jason-iq9pe 3 жыл бұрын
Really great explanation!
@abhishekguptasargupta2439
@abhishekguptasargupta2439 4 жыл бұрын
how can I increase the number of tokens? With larger text, it shows token limit error.
@ChrisMcCormickAI
@ChrisMcCormickAI 4 жыл бұрын
Hi ABHISHEK -- Unfortunately, there's no way to increase the 512 token limit without re-doing BERT's pre-training. The issue is that BERT uses these embeddings called Positional Encoding Vectors which tell it the order of the words in the text, and they only trained 512 of these. Maybe someone else has published a pre-trained BERT that supports longer inputs, though?
@shushantpudasaini2306
@shushantpudasaini2306 4 жыл бұрын
Nice work. This is the best channel for learning BERT. However, I would also recommend you to do video for pre-ttraining BERT rather than finethuning on custom dataset.
BERT Research - Ep. 3 - Fine Tuning - p.1
32:04
ChrisMcCormickAI
Рет қаралды 80 М.
BERT Neural Network - EXPLAINED!
11:37
CodeEmporium
Рет қаралды 396 М.
Amazing Parenting Hacks! 👶✨ #ParentingTips #LifeHacks
00:18
Snack Chat
Рет қаралды 22 МЛН
Incredible: Teacher builds airplane to teach kids behavior! #shorts
00:32
Fabiosa Stories
Рет қаралды 10 МЛН
OYUNCAK MİKROFON İLE TRAFİK LAMBASINI DEĞİŞTİRDİ 😱
00:17
Melih Taşçı
Рет қаралды 12 МЛН
BERT Research - Ep. 1 - Key Concepts & Sources
16:19
ChrisMcCormickAI
Рет қаралды 94 М.
Question Answering using Transformers Hugging Face Library || BERT QA Python Demo
9:57
Why Fine Tuning is Dead w/Emmanuel Ameisen
50:07
Hamel Husain
Рет қаралды 35 М.
311 - Fine tuning GPT2 using custom documents​
14:51
DigitalSreeni
Рет қаралды 27 М.
BERT Research - Ep. 2 - WordPiece Embeddings
28:04
ChrisMcCormickAI
Рет қаралды 71 М.
How I’d learn ML in 2024 (if I could start over)
7:05
Boris Meinardus
Рет қаралды 1,1 МЛН
Step-by-step Code for Knowledge Graph Construction
31:12
TwoSetAI
Рет қаралды 4,1 М.
Large Language Models in Five Formulas
58:02
Sasha Rush 🤗
Рет қаралды 34 М.
Amazing Parenting Hacks! 👶✨ #ParentingTips #LifeHacks
00:18
Snack Chat
Рет қаралды 22 МЛН