NLP Tutorial 11 - Automatic Text Generation using TensorFlow, Keras and LSTM

Поделиться
HTML-код
  • Опубликовано: 12 сен 2024

Комментарии • 137

  • @KGPTalkie
    @KGPTalkie  4 года назад +8

    at IN [78], please assign seed_text = lines[12343]

    • @rezadwiputra5339
      @rezadwiputra5339 4 года назад

      helo sir
      if you put epoch 10 instead of 100, will training with the LSTM model come when you proceed to encode and decode?

  • @arjunpatil691
    @arjunpatil691 3 года назад

    Hii can you please explain how the embedding takes place in this algo. And which word embedding did yiu used.

    • @TheTakenKing999
      @TheTakenKing999 2 года назад

      He used a one hot vector to encode each of the words, each vector would be the size of all the unique words in the vocabulary

  • @boredeggyolk7969
    @boredeggyolk7969 2 года назад +1

    You didn't do any new video? Bro, I just found your channel. And I swear this is the easiest to understand compared to any machine learning channel. it's very straightforward and educating. please know by doing this you help many people and next future generation to study. please keep it up! i'm rooting for you!

  • @BiranchiNarayanNayak
    @BiranchiNarayanNayak 4 года назад +7

    Nice tutorial. Sir also upload the character based LSTM text generation, which handles the out of vocabulary words.

    • @KGPTalkie
      @KGPTalkie  4 года назад +1

      Thanks for watching and yeah sure.

  • @muhammadzubairbaloch3224
    @muhammadzubairbaloch3224 4 года назад +2

    My best channel and guider teacher have a very good and awesome lecture. I wait for your lecture anxiety

    • @KGPTalkie
      @KGPTalkie  4 года назад

      Thanks for watching ❤️ 😍

  • @abhinavkale4632
    @abhinavkale4632 8 месяцев назад

    Just Great!!

  • @PritishMishra
    @PritishMishra 3 года назад +2

    Your Blogs are very good....

  • @ijeffking
    @ijeffking 4 года назад +3

    Good one. Thank you so much . I appreciate your easy-to-understand explanation..

  • @anuraggupta32
    @anuraggupta32 3 года назад

    Good tutorials. I wanted to just have a high-level understanding. But they are so interesting that I am going in details

  • @omniscienceisdead8837
    @omniscienceisdead8837 2 года назад

    props man, this is great content

  • @abdulaitj4491
    @abdulaitj4491 4 года назад

    Thanks for all your wonderful videos you have been posting. I really enjoy them, but been a newbie in Machine learning it has increased my knowledge and understanding. Pls can you make a video on NLP using RNN (GRU model) to predict sentiment. Thanks from UK

  • @venkatesanr9455
    @venkatesanr9455 4 года назад

    Your explanation and work are awesome, Laxmikant

  • @pratirupgoswami4373
    @pratirupgoswami4373 4 года назад +1

    Pls make a video on skipthoughts models

  • @aadarshlalchandani3487
    @aadarshlalchandani3487 3 года назад +1

    PLEASE REPLY FAST
    Hello the video and explanation are great but I'm getting an error:
    AttributeError: 'Sequential' object has no attribute 'predict_classes'

  • @jalalkasmani2575
    @jalalkasmani2575 4 года назад +3

    Can you make tutorial on BERT?

  • @5minutesmastery567
    @5minutesmastery567 3 года назад +3

    Hello Sir, Can you please provide the source code?

  • @victoretim1410
    @victoretim1410 2 года назад

    This video is really fantastic, thank you very much sir. Is it possible for you to post the code here so that we can use it to practice on our own.

  • @gopalraichand3395
    @gopalraichand3395 2 года назад

    Hello sir ur tutorial is very good but i have a doubt in generate_text function what is the value n_words which we used for iterating through?

  • @dreamscapeai7
    @dreamscapeai7 4 года назад +1

    Bro your voice is so relaxing, you put me to sleep.

  • @Sawarn69
    @Sawarn69 4 года назад +1

    Very good explanation. Start making more videos on cool projects and videos on blogs.

    • @KGPTalkie
      @KGPTalkie  4 года назад

      Thanks for watching ❤️ 😍.

  • @noushadrahim8131
    @noushadrahim8131 2 года назад +2

    can you pls share the code?

  • @thenerdsbooks391
    @thenerdsbooks391 2 года назад

    hi sir, this video was very helpful.
    I am not understanding the last part. the def function part
    Like am getting error: "y_predict = model.predict_classes(encoded)" in this line as ' AttributeError: 'Sequential' object has no attribute 'predict_classes' '. could you pleas me getting this pleasee

  • @janvisahu6958
    @janvisahu6958 3 года назад

    the sequences array that I am getting is 1 d instead of 2d. how to correct it? I've put length= 50 + 1 and followed the exact same steps. Please help. code: x,y=sequences[:,:-1],sequences[:,-1]. error: too many indices for array: array is 1-dimensional, but 2 were indexed

  • @hiteshjivnani3892
    @hiteshjivnani3892 4 года назад

    ValueError: Shapes (None, 13009) and (None, 100) are incompatible .........sir i m getting this error and it should be model.add(Dense(y.shape[1], activation='softmax')) instead of model.add(Dense(100,activation='softmax')) m i right or not sir......

  • @shanbit2074
    @shanbit2074 3 года назад

    Hi Sir,
    I am not able to access your blog and code . The link is failing. Could you please correct it.

  • @carlosdanielmoralestorres8542
    @carlosdanielmoralestorres8542 3 года назад

    Hola, el link donde viene el blog donde viene la explicación de LSTM for text prediciton, el link no permite visualizar la página, conoce el detalle? gracias!

  • @falgunikhandelwal9910
    @falgunikhandelwal9910 2 года назад

    sir second last line main n_words not defined ara h
    please help me out

  • @tech_thiru2637
    @tech_thiru2637 4 года назад +3

    start a course on OpenCV please!

    • @KGPTalkie
      @KGPTalkie  4 года назад +1

      Thanks for watching. I m preparing drafts for the same.

  • @falgunikhandelwal9910
    @falgunikhandelwal9910 2 года назад

    phle seed_text ara tha but baad m apka text dekha comment m fir recorrect krdia...but n_words k liye kya kre

  • @jalalkasmani2575
    @jalalkasmani2575 4 года назад

    Which video should I watch to learn automatic questions generation from paragraph in a text file.

  • @sebastienthiertant8373
    @sebastienthiertant8373 2 года назад

    Hey man !
    First of all, thank you for this awesome video and model.
    But I got some problem here, with the 2D ndarray transformation. At 36:07.
    My X and Y are looking like this :
    ndarray with shape (71787,)
    And of course i got this error when I execute
    X, y = sequences[:, :-1], sequences[:, -1]
    IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
    Did you already have this error before ? My lines are identical to yours.
    Thank you

  • @JainmiahSk
    @JainmiahSk 4 года назад +1

    When Will you upload deep learning tutorial? Your voice is good.

    • @KGPTalkie
      @KGPTalkie  4 года назад +1

      Hi, this video is also fall under the deep learning. I think you are referring CNN videos. Please watch it here ruclips.net/p/PLc2rvfiptPSR3iwFp1VHVJFK4yAMo0wuF

    • @ranjan4495
      @ranjan4495 4 года назад +2

      @@KGPTalkie you are very humble. Good to have you as a guide.

  • @pratikshaunale4885
    @pratikshaunale4885 3 года назад

    Thank you sir for this tutorial..your teaching is very simple for understanding purpose..I want this artical link...can u send this artical

  • @user-wu5pl4zs7r
    @user-wu5pl4zs7r 11 месяцев назад +2

    at 26 iam unable to get the get more RAM option and the code is showing error . please help me to sort this out

    • @user-wu5pl4zs7r
      @user-wu5pl4zs7r 11 месяцев назад +2

      after doing model.fit(x, y, batch_size = 256, epochs = 100) it is showing error and unable to get ram option

    • @KGPTalkie
      @KGPTalkie  11 месяцев назад +1

      This option is now removed from Google colab. You need to buy it from Google if you want.

    • @harshithgoud5902
      @harshithgoud5902 11 месяцев назад +1

      Then what is the solution

    • @harshithgoud5902
      @harshithgoud5902 11 месяцев назад

      ​@@KGPTalkie don't we have other options

    • @user-wu5pl4zs7r
      @user-wu5pl4zs7r 11 месяцев назад

      ​@@KGPTalkiedon't we have an alternate solution??

  • @amitdutta3875
    @amitdutta3875 3 года назад

    please make more video on NLP

  • @WalkingArchive
    @WalkingArchive 3 года назад

    Thanks for this amazing tutorial. Follow the tutorial on my local machine and I get the following generated text:
    "sir and and and and and and and and and and and and and and and and and and and and and and and and and ...."
    Not sure what I'm doing wrong. I copy paste your code and the same happends.
    Thanks!

  • @falgunikhandelwal9910
    @falgunikhandelwal9910 2 года назад

    hello sir last m n_word not found ara h what to do now?

  • @ikhlask7844
    @ikhlask7844 2 года назад

    Hello, is there any tutorial for doing this with a transformer model?

  • @nipungupta9914
    @nipungupta9914 3 года назад +1

    Hello Sir, Thank you for this tutorial. The explanation is very informative. I have a doubt. While writing the function generate_text_sequence, why did you use 0 in tokenizer.texts_to_sequences([seed_text])[0]? Also,, why did you add 1 to the vocabulary size? Please help me understand this. Thank you!

    • @KGPTalkie
      @KGPTalkie  3 года назад +3

      It generates a 2d array so to make it in 1d I used [0]. Like this [[value]][0] -> [value]
      1 added because in run time algorithms needs 1 extra memory slot for unknown words. Means size of known words plus 1 for all unknown words.

    • @afeezlawal5167
      @afeezlawal5167 2 года назад

      @@KGPTalkie hi sir, when I was trying this, my RAM is not getting updated . What can I do sir

  • @MrAnirbandas
    @MrAnirbandas 4 года назад +1

    I am new to ML, This video is a great help in my learning. One thing, can you please tell how to make this offline, I can copy and run the code in my PC, but the issue is the model train every time. So, how to train once and use the model again for output generation?

    • @KGPTalkie
      @KGPTalkie  4 года назад +1

      After training use model.save('model.h5'). It will save model for later use. To use it later use model = load_model('model.h5')

    • @MrAnirbandas
      @MrAnirbandas 4 года назад +1

      @@KGPTalkie Thank you :)

  • @noushadrahim8131
    @noushadrahim8131 2 года назад +1

    would you pls share the code

  • @kevinq8246
    @kevinq8246 3 года назад

    How can I predict the punctuation in a text using the same?, pleaseeee help

  • @sudheerrao9820
    @sudheerrao9820 4 года назад

    Thanks for the video...why don't you use spacy or NLTK for text pre processing and why not word2vec for embedding purpose?

    • @KGPTalkie
      @KGPTalkie  4 года назад

      Thanks for watching. This is just basic way to do it. You can watch previous videos to know more about Spacy and word2vec.

    • @sudheerrao9820
      @sudheerrao9820 4 года назад +1

      @@KGPTalkie thanks for the reply..please make video on using spacy and word2vec with RNN if possible...

    • @KGPTalkie
      @KGPTalkie  4 года назад

      sudheer rao Yeah sure. Probably Next week.

  • @shubhamrawat3366
    @shubhamrawat3366 4 года назад

    Bro are you using ram or Virtual ram?. In jupyter the single epoch taking about 700s to train. Can you help me out brother?

    • @KGPTalkie
      @KGPTalkie  4 года назад

      Please Google CoLab and set runtime GPU or TPU. You might be running only on CPU.

  • @satyamtiwari3455
    @satyamtiwari3455 4 года назад

    Where did we use NLP here?

  • @musesafayigatalo
    @musesafayigatalo Год назад

    very interesting thank you very much!!!! can i change this code to spell checker work?

    • @KGPTalkie
      @KGPTalkie  Год назад

      Yes you can!

    • @musesafayigatalo
      @musesafayigatalo Год назад

      @@KGPTalkie thank you very much. I am going to do 'Real word error detection and correction for Afaan Oromo using Deep learning approach 'for my final Msc thesis at bule hora university in Ethiopia .If you have time I will ask some some things later.

    • @KGPTalkie
      @KGPTalkie  Год назад +1

      Yeah sure.

    • @musesafayigatalo
      @musesafayigatalo Год назад

      @@KGPTalkie But there is no GET RAM UPGRADE comes me,how fix such problem?

    • @KGPTalkie
      @KGPTalkie  Год назад +1

      Hi, those options are not available now in CoLab. You need to get Colab Pro.

  • @roshankumargupta46
    @roshankumargupta46 4 года назад

    Hi Dude, thanks for the video.
    Can you please help me the below doubts:
    1. vocab_size = len(tokenizer.word_index) + 1 -> Why we are taking plus one here?
    2. model.add(Embedding(vocab_size, 50, input_length=seq_length)) - Why input dimension is "vocab_size" here?
    3. encoded = tokenizer.texts_to_sequences([seed_text])[0] -> What does '[0]' denotes here?

    • @KGPTalkie
      @KGPTalkie  4 года назад

      1. Because indexing starts from 0. So total length is last index plus 1
      2. That is the size of total words for which vectors will be generated internally
      3. It created list of list. So [0] only list. Like [[some data]][0] is equal to [some data].

    • @KGPTalkie
      @KGPTalkie  4 года назад +1

      Thanks for watching

    • @roshankumargupta46
      @roshankumargupta46 4 года назад

      @@KGPTalkie Thanks for reply but when I'm printing "tokenizer.word_index", it is showing index from 1 only so I didnt get the meaning of adding of +1.

    • @KGPTalkie
      @KGPTalkie  4 года назад

      Hi,
      This is in regard to the code file which you requested for different topics.I request you to please get enrolled yourself and show your support and love to KGP Talkie. All the code files and video lectures have lifetime access with 30 Days money back Guarantee. Code and question-answer support are also available at Udemy.
      Code files of RUclips lectures will be also available once you register in this course. Please send an email to udemy@kgptalkie.com with your registration details of this course and a list of other code files that you want.
      I promise you to give FREE COUPONS for the next course on Deep Learning and ML. You can click on the link mentioned below and can get yourself enrolled!! bit.ly/udemy95off_kgptalkie
      New content is added at Udemy:
      1. Animation Plot [2 lectures]
      2. Python Coding in Mobile [5 lectures]
      3. Complete EDA of Boston Dataset [20 lectures]
      What else we promise in this course
      1. Kaggle data EDA
      2. Text data EDA
      3. More Animation Plot
      4. More 3D plots
      5. Figure Aesthetics and Decoration
      6. Free coupons for next course
      7. And so much more.
      Hurry up!!! Only for a limited time.
      Please email your details at udemy@kgptalkie.com for the FREE COUPONS of the next course.

  • @shreyashkharat2623
    @shreyashkharat2623 3 года назад

    Sir, could you provide link to data set?

  • @sameerkumar-ei6kf
    @sameerkumar-ei6kf 2 года назад

    Where is the dataset

  • @nandinisarker6123
    @nandinisarker6123 3 года назад

    Excellent video on NLP. But I am getting an error at generate_text_seq, it says the seed_text is not defined. Kindly guide me

    • @KGPTalkie
      @KGPTalkie  3 года назад

      Please define some text for this variable

    • @nandinisarker6123
      @nandinisarker6123 3 года назад

      @@KGPTalkie I did that too, now it retuns only one word instead 10/100 words. The last line of code "generate_text_seq(model, tokenizer, seq_length, seed_text, 100)"

    • @sidraibrahim2925
      @sidraibrahim2925 3 года назад

      Hey. I have same error. Have u resolved?

    • @KGPTalkie
      @KGPTalkie  3 года назад

      Hi, just pass some seed text to seed_text = "seed text Day"

  • @Trouble.drouble
    @Trouble.drouble 4 года назад

    Sir how the grammar is taken care off

    • @KGPTalkie
      @KGPTalkie  4 года назад

      Grammer is the most difficult part. It is not handled in this course.

    • @Trouble.drouble
      @Trouble.drouble 4 года назад

      @@KGPTalkie thanks for prompt reply sir, plz give a hint regarding this, incorporation of grammar plz sir

  • @murulig1723
    @murulig1723 3 года назад

    hi lakshmi , thanks for the video, i was just following step by step in google colab but i am not getting an option to get additional RAM. could you help me here please

    • @KGPTalkie
      @KGPTalkie  3 года назад

      Hi
      Google have removed this feature. You can't get additional RAM.

    • @anonymousmind9386
      @anonymousmind9386 3 года назад

      @@KGPTalkie Then what's the solution?

    • @KGPTalkie
      @KGPTalkie  3 года назад

      Reduce the batch size

    • @anonymousmind9386
      @anonymousmind9386 3 года назад

      @@KGPTalkie I have tried but again the program crashed....what should I do, please help.

    • @anonymousmind9386
      @anonymousmind9386 3 года назад

      @@KGPTalkie Isn't there any solution? Do I need to skip the project?

  • @deeptigupta518
    @deeptigupta518 4 года назад

    Why we are taking 0 after encoded in generate function we made?

    • @KGPTalkie
      @KGPTalkie  4 года назад

      Hi please let me know time of video or notebook code line.

    • @deeptigupta518
      @deeptigupta518 4 года назад

      @@KGPTalkie Hello code line 79 @ 55:24 why we used [0] in the end?
      Do we want to grab only the first encoding of the word?
      And in pad sequences why we are using truncating as 'pre'?

    • @KGPTalkie
      @KGPTalkie  4 года назад +1

      That is seed word. I.e. You have to give first word to get started. There after it will automatically predict next one and so on.

  • @vinven7
    @vinven7 4 года назад

    Hi, Where is the notebook for this tutorial?

    • @KGPTalkie
      @KGPTalkie  4 года назад

      Please follow along the video. Do let me know if you get any error.

  • @pranjalgoyal6747
    @pranjalgoyal6747 3 года назад

    Hey, Is this model can be used to generate Hindi lyrics ( which are converted into English) ?? I am building a project and wanted to know. If anybody knows about this please reply.

    • @KGPTalkie
      @KGPTalkie  3 года назад

      I have not tested it yet

    • @pranjalgoyal6747
      @pranjalgoyal6747 3 года назад

      @@KGPTalkie means it works on English meaningful words, not on words let's say(tum hi ho)? If you test it just let me know. Thanks in advance

    • @KGPTalkie
      @KGPTalkie  3 года назад

      Sure.

  • @vaibhavgaikwad2082
    @vaibhavgaikwad2082 3 года назад

    Google is not allowing more ram

    • @KGPTalkie
      @KGPTalkie  3 года назад

      Hi that option is not available now. You need to use Colab Pro version

  • @PritishMishra
    @PritishMishra 4 года назад

    Can I get the SOURCE CODE

    • @KGPTalkie
      @KGPTalkie  4 года назад +1

      Hi,
      Source codes are being made available at kgptalkie.com
      Please keep an eye on it. NLP lessons will be uploaded in a week. You can find rest of codes there.

  • @akashpawar9058
    @akashpawar9058 4 года назад

    back again for cleaning you may easily use re

    • @KGPTalkie
      @KGPTalkie  4 года назад

      Yes. That is also an option. It is beauty of python, you have many ways to do same task.

  • @harikk7872
    @harikk7872 3 года назад

    Sir notebook for this video

  • @CuriosityUnleashedbyanarghya
    @CuriosityUnleashedbyanarghya 4 года назад

    why you always use random state as 42 only why not other numbers and how can we decide that which number we need to choose as random state...what does it exactly shows..i mean its role...ive a lots of doubt regarding this random state number...thank you

    • @LaxmiKantTiwarilaxmimerit
      @LaxmiKantTiwarilaxmimerit 4 года назад

      Random state could be anything. Fixing to any number make sure that whatever random number is generated will be always same. ML starts with some random weights and settings inside and this random number make sure that those settings are always same when you rerun or reproduce this result. random state could be anything. this you can also see as seed number for random generator. I would suggest you to read about the random generator and seed number in computer programs. I have chosen 42 as it is default setting otherwise you can select anything.

  • @firzzahrin2940
    @firzzahrin2940 4 года назад

    generate_text_seq(model, tokenizer, seq_length, seed_text, 100)
    NameError Traceback (most recent call last)
    in ()
    ----> 1 generate_text_seq(model, tokenizer, seq_length, seed_text, 100)
    NameError: name 'seed_text' is not defined

    • @KGPTalkie
      @KGPTalkie  4 года назад

      at IN [78], please assign seed_text = lines[12343]

    • @firzzahrin2940
      @firzzahrin2940 4 года назад

      @@KGPTalkie I've replaced the "seed_text = lines[12343]", but there is the output for "generate_text_seq(model, tokenizer, seq_length, seed_text, 10)"
      WARNING:tensorflow:From :8: Sequential.predict_classes (from tensorflow.python.keras.engine.sequential) is deprecated and will be removed after 2021-01-01.
      Instructions for updating:
      Please use instead:* `np.argmax(model.predict(x), axis=-1)`, if your model does multi-class classification (e.g. if it uses a `softmax` last-layer activation).* `(model.predict(x) > 0.5).astype("int32")`, if your model does binary classification (e.g. if it uses a `sigmoid` last-layer activation).
      ''

    • @adityasutar790
      @adityasutar790 4 года назад

      @@firzzahrin2940 hey bruh did you find any solution?

    • @CyborgGaming99
      @CyborgGaming99 4 года назад

      @@adityasutar790 The error literally tells you what to do. Just, instead of y_pred = model.predict_classes(encoded) , put: y_pred = np.argmax(model.predict(encoded), axis=-1)

    • @sidraibrahim2925
      @sidraibrahim2925 3 года назад

      Hey. I have same error of warning tensorflow. Have u resolved?

  • @vickychow1632
    @vickychow1632 3 года назад

    i take 6 mins to train 1 epoch... and it will cost 10 hours to train 100 epochs, anyone can help???

    • @KGPTalkie
      @KGPTalkie  3 года назад

      Which gpu are you using?

    • @KGPTalkie
      @KGPTalkie  3 года назад +1

      stackoverflow.com/questions/38559755/how-to-get-current-available-gpus-in-tensorflow

    • @vickychow1632
      @vickychow1632 3 года назад

      @@KGPTalkie oh i've missed this, it is ok now after i change the runtime type thanks!!!

    • @vickychow1632
      @vickychow1632 3 года назад

      ​@@KGPTalkie may i also ask that can i read and predict the data in csv file instead of passage in the website link?

  • @muhammadzubairbaloch3224
    @muhammadzubairbaloch3224 4 года назад

    Sir I need help deep recurrent neural network code

    • @KGPTalkie
      @KGPTalkie  4 года назад

      Zubair, You can comment below your query. We will try to answer it.

    • @muhammadzubairbaloch3224
      @muhammadzubairbaloch3224 4 года назад

      @@KGPTalkie sir I have paper and code but I am facing problem in code . please help.
      bugtriage.mybluemix.net/ and please next video lecture on on this topic