Text Classification Using BERT & Tensorflow | Deep Learning Tutorial 47 (Tensorflow, Keras & Python)

Поділитися
Вставка
  • Опубліковано 31 січ 2025

КОМЕНТАРІ • 157

  • @codebasics
    @codebasics  9 днів тому

    Folks, here's a link to our bootcamp for learning AI and Data Science in the most practical way: tinyurl.com/395u4mnm

  • @amoghdeshpande8068
    @amoghdeshpande8068 3 роки тому +17

    I think these are the most underrated videos on deep learning. The concepts are explained so well. Please keep making more videos.

  • @codebasics
    @codebasics  3 роки тому +17

    I had previously uploaded this video but code in that video had some issues handling imbalance in the classes. I've fixed those issues and recorded this new video. Thanks Abhishek and few others who pointed out the issues.

    • @mudassaraliansari8969
      @mudassaraliansari8969 3 роки тому

      Hello, sir I was trying to seach "feature engineering codebasics" your playlist was not coming .After that I have to go to your youtube channel and from there I viewed that playlist.Please check if that problem is facing my me only .

    • @Knight-Walker
      @Knight-Walker 3 роки тому +1

      Thanks for making the video again. I appreciate the work you do for everyone.

    • @rayyanamir8560
      @rayyanamir8560 3 роки тому

      @@mudassaraliansari8969 Same is happening with his machine learning playlist. Its not visible on his playlist but if i search it on search bar, It appears. Very strange.

    • @murielmoyahabo6078
      @murielmoyahabo6078 4 місяці тому

      My bert layers are failing

  • @mahedihassanshawon4821
    @mahedihassanshawon4821 Рік тому +2

    Underrated channel tbh..He needs more recognition. Thanks a lot for supporting us.

  • @fuehnix
    @fuehnix Рік тому +2

    Oh thank god, finally someone who explains well AND covers the topic in enough depth to be useful.

  • @maxhuttmann4760
    @maxhuttmann4760 2 роки тому +1

    You are awesome, this is first actual slow enough and easy BERT starting video i've seen and suited me very much!

  • @mahsasharifi2230
    @mahsasharifi2230 3 роки тому +2

    As soon as I watched this video I subscribed your channel. The videos and tutorials are super useful. Thanks for sharing these valuable knowledge with us for free :)

  • @MS-BeatrizBosques
    @MS-BeatrizBosques 2 роки тому +2

    Thank you so much for your videos! You don't know how much you have helped me. I was really scared to dive into transformers but you have made it very easy to understand.

  • @ss-dy1tw
    @ss-dy1tw 3 роки тому +5

    Thank u so much, need more videos related to NLP, need more advanced concepts/projects in NLP area

    • @codebasics
      @codebasics  3 роки тому +5

      yes I will start working on NLP soon

  • @kennethnavarro3496
    @kennethnavarro3496 3 роки тому

    Bro watching these tutorials make me want to blow my brain up with the amount of times you mention your previous videos.

  • @spider853
    @spider853 2 роки тому +6

    I knew Jeff Bezos and banana has a lot in common 🤣 Great video btw

  • @sudharsanb9391
    @sudharsanb9391 3 роки тому +2

    sir i have seen your Complete Data analyst roadmap and Data Science roadmap video.I was very amazing.I request you to upload a video on Complete roadmap for learning DSA with resources.so that it can help students like me in placements.Thank You

  • @shakes115
    @shakes115 3 роки тому +3

    Great Video! By the way, a small typo, the percentage of spam is 747/(4825+747),

  • @ellezeus
    @ellezeus 11 місяців тому

    Grazie.

  • @Sandesh.Deshmukh
    @Sandesh.Deshmukh Рік тому +1

    Well Explained ..Thank you for this wonderful explanation 👏

  • @sciadventure
    @sciadventure Рік тому +1

    Perfectly Expalined! Thanks a lot.

    • @shreyshukla8168
      @shreyshukla8168 Рік тому

      Import tensorflow_text = text
      Not working my Jupiter not book
      Mene install bhi kara to
      Colud not find a version that satisfied esa error aa raha he anybody please help

  • @kathira5691
    @kathira5691 Рік тому +2

    Thanks for sharing this nice well explained concept.

    • @shreyshukla8168
      @shreyshukla8168 Рік тому

      Import tensorflow_text = text
      Not working my Jupiter not book
      Mene install bhi kara to
      Colud not find a version that satisfied esa error aa raha he anybody please help

  • @natreven1122
    @natreven1122 2 роки тому +2

    Thank you very much! You really helped me!

  • @kemingwu2880
    @kemingwu2880 2 роки тому +1

    very helpful,thank you!

  • @ss-dy1tw
    @ss-dy1tw 3 роки тому

    Mine is ur first like, God bless U and Ur family. Kudos to u brother.

    • @codebasics
      @codebasics  3 роки тому

      I am happy this was helpful to you.

  • @pythonking_stem1527
    @pythonking_stem1527 2 роки тому

    Man, You are a legend!

  • @vahidvajihinejad3178
    @vahidvajihinejad3178 4 місяці тому

    Good job my friend!

  • @kisholoymukherjee
    @kisholoymukherjee 2 роки тому

    Thanks for the great explanation. Really heplful

  • @stanislavzamecnik3049
    @stanislavzamecnik3049 3 роки тому

    Thanks for the video. You are amazing!

  • @maxw5667
    @maxw5667 2 роки тому

    Very useful video, thanks a lot!

  • @luiscao7241
    @luiscao7241 3 роки тому +2

    Thank you very much for the useful lesson. Can you tell me what the output format of multi-class text classification?

    • @anonanon9660
      @anonanon9660 2 роки тому

      Simply add number of neurons as the number of classes in the last layer (in this video he used one, so change it), one-hot encode the classes, use a loss function that is used for multi-class classification.

  • @jatayubaxi4553
    @jatayubaxi4553 3 роки тому

    Great video. Very easy to follow.

  • @nastaran1010
    @nastaran1010 11 місяців тому +1

    Hello. I remember you said that, NN is not suitable for working with text, as some disadvantages. why you used NN as a model here?.

  • @sapnilpatel1645
    @sapnilpatel1645 3 роки тому

    Very useful video. Thank you so much.

  • @maheshreddy6871
    @maheshreddy6871 3 роки тому

    You are teaching in Nice manner. Can we have NER task Architecture explanation for Bert & How it is Working and some code for implementation of NER

  • @prabhamelady1680
    @prabhamelady1680 3 роки тому

    very nice video sir. Thanks

  • @African-lady
    @African-lady Рік тому

    Thank you so much for this video. This is very helpful for my master's project. Please the model you built in the video, is it a fine-tuning of the last layer of BERT or completely retraining all BERT layers?

  • @yusufsAnt31
    @yusufsAnt31 3 роки тому

    great video, thanks sir!

  • @arkeshashah4650
    @arkeshashah4650 3 роки тому

    very nice Explanation, very helpful to me. Thanks. Can You make Video on ELMO Word embedding?

  • @guitance23
    @guitance23 3 роки тому +2

    Quick question: Once embeddings are created via Bert, can I not simply train a SVM or Logistic Regression / Naive Bayes on them? Do I have to really create a neural network?
    P.S. Great videos as always. I have learned much more in last 24hrs than few courses combined :)

    • @zououoz3588
      @zououoz3588 2 роки тому +1

      I would like to know the answer as well :)

    • @chinmayamahapatra8783
      @chinmayamahapatra8783 2 роки тому

      Yes you can of course. But that would be context less classification and would kill the whole purpose of context in Bert. Normal classification results would not be that good.

  • @dronacharyulu755
    @dronacharyulu755 Рік тому +1

    can we use the hidden layers(only CLS) generated from the bert model as a features , to train the tfdistilled bert for binary classification task

  • @adamatom2826
    @adamatom2826 3 роки тому +3

    Thanks for these great videos. Quick question - I have watched your whole maching learning+deep learning series so far, and I'm wondering: are there ways one can tell whether the models discussed in the ML videos (linear regression, logistic, random forest, etc) versus a neural network is better suited to a situation? Or can you only know by testing all of them out, like in a GridSearchCV? Could you perhaps discuss this in a video?

    • @codebasics
      @codebasics  3 роки тому +4

      Neural networks are best for unstructured data (images, text, audio, video) and when the training dataset is huge. For structured data statistical models are preferred.

    • @adamatom2826
      @adamatom2826 3 роки тому

      @@codebasics Thanks so much for replying and for selflessly producing these videos.

  • @yonahcitron226
    @yonahcitron226 2 роки тому

    please do more in-depth stuff on NLP!!

  • @sanity5277
    @sanity5277 Рік тому

    dude you are awesome

  • @rajm5349
    @rajm5349 3 роки тому

    sir for getting embed values u explained grapes and banana r similar, then when we relate it to mails, it mean that the mails which r coming r not similar to his current situation and that result to spam

  • @rahil1575
    @rahil1575 3 роки тому

    Thanks for the video.can you please let us know,how can we proceed if the text input is high (more no of tokens)

  • @aomo5293
    @aomo5293 Рік тому

    HI, thank you for good video. please have talked before about Elmo?

  • @maxlgemeinderat9202
    @maxlgemeinderat9202 3 роки тому

    Hi, great video! What would you to to fine tune this model? :)

  • @worldinsight.999
    @worldinsight.999 3 роки тому

    sir, please make one video on named entity recognization using bert

  • @kathira5691
    @kathira5691 Рік тому +3

    I am getting No matching distribution found for tensorflow_text==2.12 error while installing tensorflow_text using pip.Could you please help on this.Thank you

    • @Ppriyank2712
      @Ppriyank2712 3 місяці тому

      have you got any solution to this?

    • @danwilshere8171
      @danwilshere8171 2 місяці тому

      @@Ppriyank2712 likely have to downgrade the python version. I ran into the same problem with python 3.12, and had to pick a prior version. python 3.9 seems to have a stable version of tensorflow[and-cuda]==2.16.1 and tensorflow_text

  • @sulaimankhan956
    @sulaimankhan956 Рік тому

    very interested

  • @verma_raunit
    @verma_raunit Рік тому +5

    The code do not work now.

    • @muhammadalzabibib2650
      @muhammadalzabibib2650 9 місяців тому

      Do you have another code please
      i need it for university project

    • @nathaliliyanage5659
      @nathaliliyanage5659 6 місяців тому

      ​@@muhammadalzabibib2650 I need tooo

    • @Thayanhchamsoccoay
      @Thayanhchamsoccoay 5 місяців тому

      ​@@muhammadalzabibib2650 stupid. I think u shouldnt go to university

  • @junaidreshi2472
    @junaidreshi2472 3 роки тому +1

    What about using sequence_output vectors as input to LSTM as it needs 3D input?

  • @chris-rahme
    @chris-rahme 3 роки тому

    Thanks a lot for the video.
    This is great for binary classification. Any idea on how to do the same when we have more than two classes? (e.g. science, technology, linguistics, other)

  • @LordPBA
    @LordPBA 2 роки тому

    wonderful!! but... what if we have 3 or more categories instead of just 2? Thanks a lot

  • @pearlrodrigues3036
    @pearlrodrigues3036 Рік тому

    Thank you so much for your videos! But i have a doubt since balancing the data in multi label classification doesn't help cause words have similar meanings ,what can be done?

  • @tanmayparanjape3733
    @tanmayparanjape3733 2 роки тому

    Can you please show how to plot the loss graph?

  • @muhammadaminkhan9328
    @muhammadaminkhan9328 2 роки тому

    Thank you sir for your valuable lectures. Can you direct me to one of your content about XLNet Model?

  • @precious_orim
    @precious_orim 2 роки тому

    Thank you so much sir pls where can I find the code?

  • @williamjiang1089
    @williamjiang1089 3 роки тому +1

    Hey, thanks for the video. I was wondering at the end for inferences, you get decimal values like 0.8 which leans towards "Spam". However, is there a way to specifically return "Spam" with like 80% confidence or something like that, instead of just the decimal values?

    • @aditya_01
      @aditya_01 3 роки тому

      yes right a custom function like def funct(score): if score>=0.5 return (score*100,"spam") else return (100-score*100,"Ham")

    • @himeshkoli8607
      @himeshkoli8607 2 роки тому

      @@aditya_01 or else we can use np.where function to classify spam and ham

  • @roopagowda9271
    @roopagowda9271 Рік тому

    Hello...can you please confirm if removal of stopwords,numbers,stemming etc is required in this case ?

  • @poojapatila5233
    @poojapatila5233 3 роки тому

    Sir if possible can you make a complete NLP playlist. Like how voice is converted to text, text preprocessing any how we know by learning from your tutorial. Then again how it will back converted to voice. ex: Alexa.

    • @codebasics
      @codebasics  3 роки тому

      yes NLP playlist is in my plans

  • @amityadav5797
    @amityadav5797 2 роки тому +1

    everything work fine but when i m trying to fit the model it is giving me error as " ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type float)." I m stuck so bad anyhelp would be appreiciatable, thank you in advance

    • @jconfire
      @jconfire 3 місяці тому

      How did the error resolve....please tell...!

  • @umarghaffar9149
    @umarghaffar9149 2 роки тому

    Hi sir, Thank you for this amazing video. I have followed your video and used bert model for text classification and the accuracy of my model is very low. Can you help me

  • @ayushbhalani7242
    @ayushbhalani7242 2 роки тому

    Can a BERT model be used for a task like scoring resumes according to job description ?

  • @AI_4214
    @AI_4214 2 роки тому

    Thanks for the video, I am getting an error saying failed to covert Numpy array to Tensor.

  • @arindammukherjee391
    @arindammukherjee391 3 роки тому

    Can you please show a real time deployment of a model like this on AWS

  • @8003066717
    @8003066717 2 роки тому

    I am little bit confused; each sentence length should be 128 and each word be of 768 dimensions..

  • @shanumathew5449
    @shanumathew5449 Рік тому

    Can you do Spoiler Detection with BERT ? I have been trying for some time but I am not able to.

  • @chinnaanjaneyuludirisala5265
    @chinnaanjaneyuludirisala5265 2 роки тому

    Thank you for explaining Bert model. I am not why the model is taking 2 hours for each epoch, has anyone experienced the same ?

  • @anjalipatel9028
    @anjalipatel9028 9 місяців тому

    When I am using bert,then it is not necessary to remove stop word from corpus?

  • @guillaumeguitarian9642
    @guillaumeguitarian9642 2 роки тому

    Hi, thanks for the Vid.
    Is it possible to make that code run with and AMD GPU ?

  • @slatan7239
    @slatan7239 2 роки тому

    How can I download the datasets which is used in this video? Can you give me the link?

  • @bhuvneshsaini93
    @bhuvneshsaini93 3 роки тому

    Hi, Last dense layer throws an error if classes more than 2, example spam, ham ,social. How to set output (Dense) (None, 1) 769 dropout[0][0] to output (Dense) (None, 3) 769 dropout[0][0]

  • @serhatkalkan2339
    @serhatkalkan2339 3 роки тому

    Is there much to adjsut for multiple classification?

  • @buddhikaweerasinghe4113
    @buddhikaweerasinghe4113 2 роки тому

    How do we save the model & use in a another application ? It throws an error when I load the trained model from saved path.

  • @hiralpatel1838
    @hiralpatel1838 7 місяців тому

    Hi, if I have multiple categories that I want to sort my data into (right now in this video there are 2: ham and spam) how might I adjust this model? The sigmoid activation function would not be usable correct?

  • @subratasaha4446
    @subratasaha4446 2 роки тому

    Sir If it is a multi class classification the where should I change the code

  • @mchafe
    @mchafe 3 роки тому

    Please Sir, how can I use BERT Embedding as input to Embedding layer of an LSTM.
    Thanks

  • @rawhit.narwal
    @rawhit.narwal 2 роки тому +1

    I can't find the dataset can someone help me

  • @AreebaBatool-nt2hz
    @AreebaBatool-nt2hz 8 місяців тому

    can you provide me the link of this data set

  • @sulaimankhan956
    @sulaimankhan956 Рік тому

    Sir, I need code as Classifier without sequential layers.

  • @pwchan9748
    @pwchan9748 2 роки тому

    is it possible to add custom tokens or synonyms to the Bert model? for example, J=J, Q=Q, A = Apple, something like these. if it's possible, how to do it on Tensorflow?

  • @fordtom0
    @fordtom0 2 місяці тому

    good

  • @Areshk
    @Areshk 11 місяців тому

    I have almost 1200+ labels, It is a good idea to use this model?

  • @smartoo80
    @smartoo80 10 місяців тому

    @codebasics what if I have more then one category who to deal with that

  • @nekopus
    @nekopus 2 роки тому

    anyway, can we convert this transfer learning to tflite format?

  • @meceffeukada3767
    @meceffeukada3767 3 роки тому

    What's the point of inputs classes (spam/ham) here ? why you didn't use them ?

  • @varunsayalauthor
    @varunsayalauthor 2 роки тому

    Great video. I am facing an issue installing tensorflow_hub: cannot import name 'deserialize_keras_object' from partially initialized module 'keras.saving.legacy.serialization' . Any thoughts?

  • @sadikaljarif9635
    @sadikaljarif9635 2 роки тому

    what is bert_preprocess???can i use this for distilbert for fake news detection???

  • @ashwinideshmukh2198
    @ashwinideshmukh2198 2 роки тому

    sir what if i have multilabel dataset like 6 labels

  • @saumyabansal3549
    @saumyabansal3549 3 роки тому

    How can we apply BERT on multiclass classification problem?

  • @johnleeyl123
    @johnleeyl123 5 місяців тому

    your code on text_input (input layer) is not working

    • @guesswho4114
      @guesswho4114 4 місяці тому

      i am also facing value error while creating bert layers did you find the solution

    • @murielmoyahabo6078
      @murielmoyahabo6078 4 місяці тому

      ​@guesswho4114 hi did you find solution on bert layers. I am also stuck there. Preprocess is not working

  • @sudarshanaramireddy373
    @sudarshanaramireddy373 2 роки тому

    Is there a code for NLP Model without labels (i mean Unsupervised ML) ?, i am struggling to find ;)

  • @shezanmahmud1621
    @shezanmahmud1621 2 роки тому

    How can I set up learning rate here?

  • @mithilanavishka4531
    @mithilanavishka4531 2 роки тому

    If the value is more than 0.5, how can it be a spam email? Why can't they be ham email?

  • @ajitkulkarni1702
    @ajitkulkarni1702 Рік тому

    one question: we had 747 data points for each class, so how in confusion materix values are less as 187

  • @DiAd188
    @DiAd188 3 роки тому

    Hi Sir,
    Instead of your output I'm getting:
    Keys : ['input_mask', 'input_type_ids', 'input_word_ids']
    Shape : (1, 128)
    Word Ids : Tensor("strided_slice_3:0", shape=(12,), dtype=int32)
    Input Mask : Tensor("strided_slice_4:0", shape=(12,), dtype=int32)
    Type Ids : Tensor("strided_slice_5:0", shape=(12,), dtype=int32)
    Do you know why I would get this output?

  • @francisatoyebi
    @francisatoyebi 2 роки тому

    Please help,
    How can I input SMOTE for oversampling in this model?

  • @snehareddy-w1j
    @snehareddy-w1j 11 місяців тому

    what i have to search in kaggle to get that dataset

  • @tanusreenath3857
    @tanusreenath3857 2 роки тому

    Can you share the dataset link

  • @codewithgtm
    @codewithgtm 2 роки тому

    Which algorithm we are using for the text classification here? Can anyone tell me please?

  • @mithilanavishka9884
    @mithilanavishka9884 2 роки тому

    Thank You very much for this greatd video, I successfully got theoritical knowledge throgh this tutorial and I could completed it, after that I applied this for real problem I need to solve
    when I train model, I got this error --> "Failed to convert a NumPy array to a Tensor (Unsupported object type int)."
    place where getting error --> model.fit(X_train, y_train, epochs=5)
    I tried different solution on the stackoverflow like below, but could not get a solution,
    1.X_train = tf.convert_to_tensor(X_train)
    2.X_train=X_train.flatten()
    If You have a idea on my error give me a hint
    *Is bertmodel not allowed numbers and special chrachters*

  • @arvindmewada7355
    @arvindmewada7355 3 роки тому

    Can we put bert output into SVM

  • @souvikghosh1735
    @souvikghosh1735 3 роки тому

    Sir How do I download the dataset?Can You provide the link