Placeholder Image

字幕表 動画を再生する

  • what is going on?

  • Everybody.

  • And welcome to part seven of our chapel with python tensorflow and Deep Learning tutorial Siris in this video over me doing is actually one deploying a model but to talking about a real high level sense, at least two major kind of model frameworks that I've personally used for chatbots.

  • Then we'll go ahead and deploy model, and then we'll talk about some more of the intricacies of how those models work and what you can kind of do to tweak them.

  • So first of all, when I have, like, first started looking into doing chatbots, it was actually kind of challenging to figure out like Okay, well, okay, let's say you wanted to deep learning and you don't want to do a rule Bates chat by like, what do you even used to do that right?

  • Uh, and there was a lot.

  • There was so much information out there for doing like a rule based chap, most likely because the most popular and the most successful chatbots, really to date have been rule based, at least to some degree, arguably the most successful ones.

  • Right now, we're kind of like mixtures of the to like have rules and have a I.

  • And as we'll see here, and at least all the models I've had almost always needed to upend some rules to the output if not to stop the A I just repeating itself, but also just to stop responses that just never make sense or whatever.

  • So chances are you're almost always gonna need a combo of the two.

  • But maybe in a few years we'll be able to make it advanced enough chat bots that don't.

  • Anyway, as I was looking, I stumbled into sequences, sequence stuff with tensorflow.

  • And, um, I got kinda hooked into their translation tutorials at the time.

  • It was an English to French national.

  • See, this is for specifically version 1.1.

  • Um, actually, I don't even think this works in 1.1 because they're using a different version of sequence to sequence like, I don't think this actually matches the code that's under get hub.

  • But regardless, if you want her in this code, you really should be using tensorflow one point like you actually can't even use the latest version of tensorflow, which is unfortunate because, um, this is much slower.

  • But Anyway, this is what I first found.

  • If anybody's been following the stream or the chap on on Twitter for the first while it was actually based completely on this model.

  • So I was like, you know, reading through this model and seeing you know, this one was English to French translation.

  • Um, but then I was like, Well, if you can translate from English friend, surely you could translate, um, uh, English to English.

  • Now, as I'm gonna talk a little bit as we get into the intricacies, a champion is not English to English translation.

  • It's actually, I would argue a chap out is more complex than translating English to French.

  • But we'll talk about that a little more later but basically boils down to there's no 100% translation.

  • There's not even like three translations that it could be.

  • There's not five.

  • There's like millions of translations we could have.

  • So any input in chat input could have just infinite chat outputs that would be acceptable.

  • So anyway, that's why that's it's much harder, in my opinion.

  • But regardless, this was the first model I used.

  • It actually does work.

  • Um, I did a I'm trying to remember back now, I think it was a 10 24 by three model.

  • So three layers of 10.

  • 24 nodes.

  • If I recall, right, that was the size of the network.

  • Um, and that was pretty much all that was the premise.

  • The only thing you really need to switch around.

  • Um, anyway, this produced a decent chap pot, but I just wasn't exciting.

  • So then, as I'm following the updates coming out of tensorflow, you've got dynamic, recurrent neural networks.

  • Then we've got the attention mechanisms and bidirectional neural networks.

  • Bi directional current neural networks, That is, um and so that leads us here to the neural machine.

  • Translation.

  • That's a much more recent is actually still being updated by tensorflow.

  • If you do follow the sequence of sequence, just will say it's because it's using an outdated form of secrets and sequence specifically because it doesn't support the, um I don't know if it's officially the dynamic Orin, and that's intense air flow, but that's basically what it is.

  • The sea old secrets.

  • The sequence didn't support a dynamic variable input.

  • Basically, so brings us to this the neural machine translation you could go through the editorial.

  • There's probably a lot of good information here that you could continue to learn.

  • Um, but basically, it's It's fairly similar to even this tutorial, at least in explaining sequence to sequence and what's going on because you basically you've got the input string.

  • It needs to be fed through some sort of encoder, and then it gets fed through the neural network and then that output, because again it has to be converted to numbers.

  • Somehow then that gets fed through a decoder, which translates into whatever you want.

  • So anyway, um, this is more along the lines of what we're going to be using.

  • And like I said, if you want, you can follow through here.

  • Um, and you can download it from here, but we've actually made a few changes.

  • Which brings me to the following project I've been working on with Daniel here.

  • It's basically a set of utilities sitting on top of tensor flows and empty coat, but we didn't need to make one change to an empty.

  • It might not even be required anymore.

  • But at least at the time, um, nnt requires tensorflow 1.4 point out.

  • But for whatever reason in there.

  • Uh, I forget which one it was.

  • But anyway, one of the utility scripts that basically checks to make sure you have the right version it check for, like, a really specific version, which pretty much always failed.

  • So anyway, we made that change, and then we might have to make changes later on s.

  • Oh, yeah, you can just grab this recursive lee and get that.

  • So you come down here and see this lovely read me that we've been building, but basically get the package.

  • So get clone recursive and then we'll settle this up, so I'm actually gonna go ahead and run through that myself.

  • So I'm just gonna pull this over here.

  • I'm gonna use paper space.

  • You don't have to use favor space.

  • You can use your own.

  • You can do this locally.

  • You can actually do this locally on your CPU.

  • You could, in theory, trained it on your CPU.

  • It will be very slow.

  • Um, but you can't.

  • So there you go.

  • So I'm gonna go ahead and I'll put a link in the description for referral code.

  • If anybody wants it, it's $10 which will be more than enough to get you through training a decent chap out, which again in production, Like the chap on on Twitter That responds to you within seconds.

  • In response to multiple people in seconds, I made him with, um, or he is in production on a CPU VPs on digital ocean.

  • So, uh, so you can definitely run in production on a CPU.

  • It just takes forever to train it.

  • So anyways, uh, on a box, But I want 16 0 for, uh, if you are falling and you're gonna go to paper space, make sure you choose 16 or force you got Python three tens of low 1.4.

  • All that good stuff, this'll is probably gonna be fine.

  • I'm gonna go with this one.

  • Uh, now we'll just call this an empty tutorial.

  • I do want a public i p if I want to transfer some data and good creates space.

  • Okay, so I'm gonna create that, and then I'm gonna posit while I'm waiting for my password and all that, and for let's get split up and then our, uh, restart as we, uh as I can log in and actually grab to get having all that all right.

  • And we're back then.

  • Actually took much longer.

  • Something came up, but I guess to you, it doesn't seem like it took any time.

  • So anyways, once you've got your machine up, I'm gonna go ahead.

  • And Well, first of all, let me pull up that get home page these fire Fox.

  • Nothing upset.

  • Just cancel.

  • Oh, it's not gonna pop out.

  • Cool.

  • Okay, so we're go to get up dot com.

  • So lash Daniel, I'll put a link in the description.

  • By the way, if I forget someone remind me, uh, and I'll put one in there cook, yella and an empty dash chat.

  • But it is the name.

  • Let's see if we got it right.

  • We did.

  • Okay.

  • And if we just kind of scroll down here, here are the basically the setup steps.

  • So I'm just gonna run through these and kind of give a little bit more explanation, but it's pretty much just this.

  • So I'm gonna go ahead and copy this, and we'll just open up terminal here, change directory into desktop, make this a little bigger, and then paste.

  • So when a clone this recursive lee, because we did make a slight modification to an empty, um, pretty small one at the moment, but it might grow in time, so you probably want to clone it recursive lee.

  • But, Frito, take the official nnt and see how it works for you.

  • Uh, anyway, once you've got that, uh, think we're gonna just change directory into your I'm the one that wrote this this setup.

  • But anyway, I should know me.

  • Just move this over so we'll choose directory into the chat about directory and then, yeah, we're gonna run a pip.

  • Um, this would be a good time, Thio mention though you really want to be on Python 3.6, especially if you're on Windows.

  • Python 3.5 on Windows has, like, a weird and coding bug with least with tense or flow.

  • But I'm pretty sure it's all of python 3.5.

  • There was a pep.

  • I forget which one it was, but it got fixed and python 3.6.

  • So I highly suggest even if it runs, it starts to run in 35 Eventually, you'll hit this weird encoding error.

  • So even though your opening and reading everything in ut f a, you're still gonna hit it with 35 for some weird reason.

  • Uh, anyways, we're gonna pip.

  • But again, make sure you know your python version and pip and all that is python 3.6.

  • So pip in stall Dash art I did not hold my requirements text, so that should just basically it's tensorflow gpu one point for, um, call a rama T Q d m in Reggae X.

  • So there's actually a ray X package, which is a little faster than the standard library.

  • Just break X on.

  • The reason why we're doing that is our token Izer is using regular heavily, and we want to go as fast as we can.

  • When we're doing that, prepare data on smaller data sets and stuff.

  • It really is a big deal.

  • But like for 2017 for example, those files for like, the whole year of 2017 each of those training files is gonna be like 12 13 gigabytes even more.

  • If you didn't have any rules as faras, like a score and all that, um Sonny was yeah, make sure you get the requirements and then whenever you're done, you change directory in to set up, and I'm just gonna pull it up real quick.

  • Um, I'm not actually gonna make any changes to set up, but I just want oh, bring your attention to it.

  • So in set up, there are quite a few things that you can modify.

  • Here.

  • You can modify answers to replace that's in the output.

  • You can modify protected phrases that you actually want to be token ized together.

  • So the two organizer is going to split things up.

  • But sometimes you don't want to split things up.

  • I'm trying to think like some websites, for example, like something something something dot com.

  • We'd like to maybe not token eyes.

  • That period in the calm would like google dot com.

  • To be token ized to be one token, that is google dot com, not Google.

  • As one token dot is another con, for example.

  • So that might be a certain regular expression that you want to protect?

  • Um, uh, yeah, the replacing the out, Uh, on the output, you can also blacklist certain outputs like words, stuff like that.

  • Like if you want to not, Do you want to make sure your chat, but it doesn't say bad words or something like that you can blacklist them there.

  • Um, any way that you can, you can check those out.

  • But the main thing that we're gonna be looking at is setting Stop.

  • I'm gonna pull that operate quick, and I'll see if I consumed with.

  • Plus, I can't.

  • I'd like to make it just a little bigger.

  • It's not like it's gonna work, but anyways, uh, hopefully you can see that you might full screen, but anyways, vote capsized is 15,000 here.

  • All these settings are pretty much in place for about four gigabytes of the ram.

  • If you have more than four gigabytes of Iran, the first thing you should do is get vocab to more like 100,000 with, um, really 100,000.

  • You can get bigger than that, but 100,000 is kind of a good starting point, but 15,000 you'll still actually get a decent bottle at 15,000.

  • Um, the other stuff, I really don't want to spend too much time explaining all of these parameters in this video.

  • That's what I'm gonna do in the next video.

  • But if you want, if you're familiar with these things, go for to play around but basically the first thing you might want to change his vote capsized.

  • But we're not gonna do anything there.

  • So just, I guess just leave that the way it is.

  • And then we're gonna run prepared data.

  • So I'm gonna go ahead and just do python again.

  • You better be Python 36 So my end python is 36 But make sure you're gonna regret it if if you don't do it, um and then we'll just run python prepared data dot pipe in this case are training files are pretty small, so I guess I should have mentioned.

  • So this comes with some sample data just so you can quickly run this and tested or whatever, but chances are many you guys that are following along right now, you probably have your own train dot from and trained out, too, in your own test files and all that.

  • If you do, before he run prepared data.

  • Sorry, You should you just throw them into new data?

  • Just replace whatever is here.

  • And then once you replace those files, go ahead and run.

  • Prepare data again.

  • That's written in the written and read me.

  • I just kind of skipped over that.

  • But yeah, If you have your own data, go and replace it, then once you've prepared the data again on riel sized files, that might take a little longer on, like the 11 gigabyte files it seemed to take.

  • Um, no, Pull it up real quick.

  • Probably about an hour ish for me.

  • T create those files.

  • So smaller file there.

  • It's not gonna take too long.

  • Um, anyway, uh, then what we'll do is just change the record back toward the train file is and then we can actually just run Python trained up pipe and then that's going to start the network training.

  • And it's gonna output some information here, like learning rate decay factor.

  • In this case, it's telling us a little bit about what network is comprised with again, all that stuff, like the bidirectional stuff, all that stuff I'm going to cover.

  • I just really like the training is what's gonna take the most time.

  • So I figured you guys could start training model, and then I can tell you how to tweak it from there.

  • Um, these outputs happen every 1000 steps, so you'll see the source is basically the input data.

  • The reference is the real output from your training data and then an empty is what your chat responded with.

  • As you can see, this is damn purposes, purposes, and it just repeating itself, because it really it just it just started.

  • So it hasn't learned anything, But over time, you should.

  • You will hope to see that this, uh, this improves.

  • Uh, the other thing, too, is in.

  • As this train's inside your model directory, you're going tohave train log.

  • And this is where you can bring up tents aboard again.

  • I think at this point I'm gonna cut it.

  • And then in the next video, I'm gonna start talking about all the options, the things that we can tweak looking into tense aboard that kind of thing to see kind of how our models actually going.

  • And I can actually I can show you a model that trained over time, and we can look at it intense or boarding all that.

  • So that's what you guys have to look forward to.

  • If you have questions, comments, concerns, whatever up to this point, for free to leave them below.

  • Otherwise, I will see you in the next door.

  • Oh, and just in case some of your impatient, I'll just explain really quickly.

  • You're gonna see these every 100 steps.

  • Basically, it's gonna tell you how quickly each step took it, depending on how bigger model is, what kind of machine you're running it on.

  • That might very this is, I think that's words per second.

  • PPL's perplexity.

  • You'd like perplexity to drop.

  • Um, g n I think it's great noise.

  • Uh, and then ideally, that's gonna probably hopefully fall a little bit.

  • But really, the big thing we want to look at is perplexity.

  • We like perplexity to drop.

  • And then the blue score we'd like blue to to rise zero blue scores for okay.

  • So anyway, for those of you who are super impatient that those are the things you want to see, you can start tweaking your network to try to make those things happen.

  • Um, but honestly, this model, especially if you're doing bi directional even after the 1st 1000 steps, you should have a model that's starting to look coherent.

  • Um, I'm not sure on this training if you're using the full training data set like the ones that we built, Yeah, it should look pretty good.

  • I'm not sure on the sample data.

  • What's gonna look like after 1000 steps, but there you go.

  • Okay.

  • So I waited.

  • I'm impatient to.

  • So after 1000 steps, actually still doesn't really look that good.

  • Um, maybe it's cause of low vocab.

  • Maybe just by chance, But actually, the 1st 1 I trained after 1000 steps, it started looking pretty good.

  • Maybe that was just by chance to but anyway, really?

  • That's all for now.

  • I'll see you in the next tutorial.

what is going on?

字幕と単語

ワンタップで英和辞典検索 単語をクリックすると、意味が表示されます

B1 中級

モデルのトレーニング - ディープラーニング、Python、TensorFlowでチャットボットを作る p.7 (Training a Model - Creating a Chatbot with Deep Learning, Python, and TensorFlow p.7)

  • 2 0
    林宜悉 に公開 2021 年 01 月 14 日
動画の中の単語