Placeholder Image

Subtitles section Play video

  • what is going on?

  • Everybody.

  • And welcome to part four of our fund with Neural networks tutorial series.

  • In the last tutorial, we began simplifying our input vector here.

  • But we left off with the understanding that, hey, this is a character level generation model at generative model.

  • And really, everything is a string, Uh, so we don't actually have to adhere to any array or any other structure at all.

  • We can change this to be anything we want.

  • So let's make some of those changes and then build our training set, and then hopefully all in the same tutorial, begin training and see what we can come up with.

  • So, uh, to begin.

  • And actually, I think I'm going to make a slight change to the text based version of this tutorial, and then we'll see which one does better.

  • Because, actually, I have an idea of how I want to change it.

  • So I'm actually gonna change it.

  • Anyway, Let's get started.

  • So, uh, so the first thing is, um, we want to like what?

  • It would break right here.

  • We could print.

  • What if we print string pixels, stream string pixels?

  • Um, so we'll convert pixels to a string, and then we're gonna rip dot Replace any spaces with no spaces.

  • Run it, ship it.

  • Ready.

  • Zoom out because it will be ready to see it.

  • What an ugly, I guess that's a seven C s.

  • Seven.

  • Okay, so there's our data set.

  • I mean, that was a hard number.

  • Tow to recognize.

  • Let's just do another one real quick.

  • Um, but you could you could recognize it.

  • Still.

  • Okay, there's a three is clearly a three, and now the date is even more condensed.

  • We saved, like, 30% of our space, actually.

  • More than that price, half of the space or close to 1/2 because there was a space for everything, so we just saved a tune of space.

  • Okay, So what we want to do now is begin to, um, like, So we could do the same thing with label, But I'm not gonna waste time with that.

  • Just understand that that's what we're gonna do.

  • So now what I want to do is we want to build this training set.

  • So how are we going to do that?

  • So if we look in the text based version of tutorial basically what I want to do.

  • My idea was to take, you know, this bit right here.

  • So this would come first.

  • And then it was also the number would come first, and they would always be followed, whatever the class of that number is.

  • So then the my proposal is that we could take any number right from the validation set, converted just in this exact same way.

  • Feed that in as the primer, and then the output should be the one hot vector.

  • And in fact, we could even leave spaces in that one.

  • But I'm not gonna do that.

  • I mean, you keep that.

  • So in the text based version of senatorial, um, we didn't convert it out to be too to one hunt vector.

  • Now, since then and since I did, the generative model actually did the generative model in a slightly different way.

  • And I'm curious if I should do that, do that method instead, I don't think it's gonna make any difference the other way.

  • Be It's really challenging.

  • I really don't know.

  • I'm gonna try it because it worked the other way, so I'm gonna reverse it.

  • I know that doesn't mean anything to you.

  • at the moment.

  • But like I said, I'm gonna change the text based version.

  • So, um so yes.

  • So basically trained, it will look just like this on Lee.

  • This will be condensed a cz Well, and then you just do that.

  • Maybe New line, new line for the next classifications and just keep doing that.

  • So we're gonna build a training set that looks like that.

  • So let me, uh let's do I kind of wanna Since I already know inner m nus data set, I'm gonna do two things.

  • One is we're gonna try to classify numbers and the other we're gonna try to go the other way where we say, hey, draw this number.

  • So I'm gonna make a directory called Classify Heading back into our script.

  • Now, what I'd like to do is, I think we'll keep all of this, but I'm actually going thio gonna delete all of this code, and we're gonna write out the new version that we're gonna be working with.

  • So I'm actually going to say next batch will do 10,000 samples and I let you do it all.

  • Let's just do all the all the samples.

  • I think it's like I can't.

  • I want to say there's only 40,000.

  • We'll just do this and we'll do all of them, whatever that number happens to be.

  • So now what we're gonna do is I'm just gonna fix that and zoom in, scroll down a little bit and begin.

  • So we're say, with open Kill Asif, I slash input text with the intention to offend as f they were gonna say, four by data in and new rate.

  • And in fact entrance.

  • Yeah, in enumerates, um, batch exes.

  • What do we want to do?

  • Well, um, we also could zip these together and then iterated through them.

  • I'm just doing it this way, so I don't have to do that.

  • But that would actually be the python IQ.

  • Way to do it anyway, You'll see what I mean.

  • Data equals np dot Round ins, batch, exes, exes.

  • I, um and then dot as type, it's The label is equal to basically the exact same things.

  • Copy pays.

  • Don't forget to do wise and you're gonna get now.

  • Pixels is going to be data diary shape 28 28.

  • Don't forget to put that in its own little to pull Why did you do that?

  • That's not okay.

  • Thank you, sir.

  • Um, now we're going to say now we convert these two strings.

  • Organise a string label is evil to string label.

  • So So this is kind of what I want to change.

  • Um, I'm trying to think if I want to do this or not, I wonder straightly.

  • I think what I would like to do is sorry.

  • I'm trying trying to decide how you want to do this.

  • I want to say I think I'm gonna do this.

  • NPR, GMAC's the label and then, huh?

  • I'm trying to remember how you can make because you could do like M p zeros ones.

  • Um, I just want to make a long array of what the number actually is.

  • I don't know that this is actually gonna work the other way.

  • Um, deposits for a second while I think about how I want to make this change.

  • Okay.

  • What I'm gonna do is yeah, Index underscore.

  • Value is gonna be NPD are Max of whatever the label is, there is a new underscore label is equal to the n p dot array of 100 times.

  • Whatever the index value is.

  • So to be a lifesaver, the index value, let's say it's a to the index value will be a two, and then 100 times that will be just like these array.

  • That's 100 two's.

  • Okay, uh, then what we're gonna do is we could leave it that way, but I'm gonna issue a dot reshape, um, and we'll reshape it to a 10 10 by 10.

  • So that's our new label.

  • And at this point, it should be already as this.

  • So it'll look kind of like this on Lee.

  • This isn't quite it.

  • Um, yeah, I'll just do.

  • We'll print this out.

  • So this is print, uh, new label lips.

  • Uh, and then we're importance time and just sleeps for a very long time to settle pause right there instead of iterating through the data.

  • So in this case, it was a five.

  • So it was just kind of looked like that.

  • Okay, so that's our new label, So I'm gonna use that now.

  • Um, So what I'm to say now is string image, so str image is equal to string pixels dot Replace and then we're gonna replace all of the spaces with no spaces and then we're gonna do the exact same thing to string label.

  • So string label is string new label, and we'll replace them.

  • Um, again, in the text based version, I actually just used the one hot array and we convert it, and then we get rid of the spaces.

  • Um, but I'm curious to see the results of doing it this way.

  • I'm just curious.

  • I think it it's more robust.

  • Um, so when you use the one hotter Ray, it's only has, like, one opportunity to get it right.

  • And if it screws up one boom, the whole game is over.

  • Um, so I'm curious if this will make it better or not, I really don't know.

  • I don't have the answer to that.

  • We're gonna find out.

  • So then what we're gonna have is really say classify underscored data, classified data equals.

  • And then we're going to say, um, I kind of want to just copy and paste this one, but Okay, um, string formatting followed by a single new line.

  • Um, and then we're gonna have the classification.

  • Now I'm trying to see if it really wanna have this or not.

  • If I want to do because sometimes you want to, like, have some sort of dictation.

  • Of what?

  • What?

  • Um, what's your classification versus what is your, um, input data?

  • Because they're both gonna be array values.

  • I think I will.

  • I think I'll just like in case it in, like a colon or something like that.

  • So So, yes, So we'll do a new line, followed my colon, some more string formatting, another colon and then we'll just do new landline.

  • So then dot format.

  • And then it's the image followed by the late books is a classification tests of string image String label.

  • Okay, And then the other way around would be, you know, like to do generative you would.

  • Actually, he would start with string label, followed by the image.

  • Now what I'm gonna say is f dot right?

  • Classify underscored data looks good.

  • Let's go ahead and remove the sleep, and then we'll run it and see what happens.

  • Cool.

  • So run.

  • Hopefully no heirs, and then as that's running, let's check the output and make sure that it's kind of what we're expecting.

  • Just make sure it runs.

  • Do we always number not printing anything so inside classifications have input that text.

  • It doesn't appear to be growing.

  • Um, should grow.

  • But maybe because we opened it with the intention.

  • Do we open with the intention of writer?

  • No, it's upend.

  • I wonder why it wouldn't go.

  • We price should have just done 100 to see if this actually works or not.

  • Mmm.

  • Not content to know if this is done or, uh, classified data.

  • Hermie wants deposit.

  • I'm just not sure we should have picked, like, a smaller, smaller number.

  • First to test to make sure that say, even works deposit.

  • I'll do a smaller number and see what happens.

  • Okay?

  • I don't know.

  • It just got kind of funky or something on me, but ah, it looks like it's done.

  • Now, I'm probably gonna reload it.

  • Maybe redo it for I'm not sure if it really finished if it really got all the samples or not, but you can see it's it's actually quite large.

  • Um, quite large data set.

  • Um, mine is 100 and 12 megabytes and size.

  • So quite a bit larger than the other sets that we've been using up to this point.

  • Now, um, it looks like you know, so basically, you've got the number, and then you're hoping basically to use the number as the primer and then you're hoping that it would produce output like this?

  • Um, that's the hope.

  • That's a curiosity, actually.

  • Don't know the answer to this question because I made a live change.

  • The other one sort of worked, but it was it was not acceptable.

  • Some curious Run through this one to see if this actually produces a better results or not.

  • So, anyways, now we need to do is actually train this model.

  • So what we need to do is we're gonna just, you know, it's an amnesty class M in ist er in classified.

  • That's our data set.

  • And then we also want to go ahead, and we'd like to have a pretty large sequence length.

  • I only think I'm gonna look at the one that I used for the generative model.

  • I want to say it's like 500 or something is what I went with.

  • And again, anybody with a lower end GPU is not going to be able to do this.

  • Um, trying to see what I used.

  • Oh, actually used to 800 1 28 by three with bat.

  • Hello?

  • With a batch size of Okay, I'm gonna try it.

  • I'm gonna try it.

  • I've tried that one before.

  • So So what I'm gonna run is after I'm done bashing my glasses off my face.

  • I'm going to say we've got the input that types ready to go, Let's do it.

  • So let's go into the root dura with trained up pie and let's run command right Click.

  • So trained up pie and rather than M is draw, too.

  • I'm going to do but classify it's gonna be a 1 28 by three with 28 batch size and its sequence length of 800.

  • And, uh, that's the one I want to train and we'll see how that goes.

  • Um, so, yeah, I'm gonna go in, turn that one.

  • And, uh, I guess probably come back in the next video and what kind of data And, oh, it's m nus data set.

  • I was like, what?

  • M nus data set like that.

  • Try that.

  • If that works again, depending on your jeep, you and all that, you may or may not be able to run such a thing.

  • Like an 800 sequins.

  • Length is quite long, but yeah, just make sure that starts to train, and as long as it does, I'm gonna break here.

  • And then, uh, we'll pick back up in the next tutorial with the results, and we'll kind of generate through it and test it and see how it did.

  • Um, I think I just pause it and then see if it so it's going.

  • It's a huge data set, so it's probably have it's gonna take a while.

  • We'll get through it all and create the vocab and all that.

  • Okay, so I was actually just absolutely blowing memory.

  • So I really wanted to test this with at least 700 plus sequence length, and I just couldn't I didn't want to make the batch size smaller than 28.

  • So I launched up my paper space with a P 6000 ju bu, which gives me 24 gigabytes of the Ram, and it is now training.

  • Um, make it whatever size you want and whatever size will fit.

  • Normally at this point, I I I tout the paper space and give a referral link and all that, but this is probably like, this is strictly research.

  • There.

  • I don't have very high confidence that this will work.

  • So you don't really need to follow along.

  • You can just kind of see what my results are, but anyways, it's off.

  • It's gonna take a very long time to go through 50 e pox.

  • I'm not really sure I'm gonna wait for all 50.

  • Um, but I'll probably get trained for for quite a while.

  • Um, open in terminal here, Uh, tense aboard Longer equals longs, and I'll probably just watch the graph and see, um, open link Been.

  • Look, one of those should work.

  • Oh, I can just cancel here, please.

  • Thank you.

  • Because this move, that's interesting.

  • It's a very weird, uh, hop there.

  • Oh, because we've moved.

  • Oh, this is Oh, my Yeah.

  • Okay, that's all the same.

  • So here is our actual loss.

  • Wow.

  • Wow, that that dropped a lot Really quickly.

  • That's interesting.

  • Hey, anyway, um yeah, Okay.

  • Uh, I'm gonna stop now.

  • That's gonna take a really long time.

  • I don't really want to do necessarily the math, but basically, we've got to do, um, all of those batches, like 256,000 batches.

  • One second, actually.

  • Okay, so this will take at this rate 56.8 hours to complete.

  • So over two days of training to get the answer there.

  • So I doubt I'm gonna let it go for an entire two days of training.

  • But this seems like a pretty good place to stop.

  • I might even leave this training and then carry on with the next phase of this tutorial.

  • And then that way I can actually do be doing multiple things at once.

  • And then we can check the results later because I don't think many people are gonna be able to even train this model.

  • So most people probably aren't even going to be following exactly along with me.

  • Anyways, that's all For now, if you like, like this content you want, support me in the content.

  • You know the deal Python programming that slash support.

  • Otherwise, you've got questions, comments, concerns, whatever I feel for you leaving below.

  • Otherwise I'll see you in the next tutorial.

what is going on?

Subtitles and vocabulary

Click the word to look it up Click the word to find further inforamtion about it