Can OpenAI Codex Create AI?

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

That... Seems like a problem. This is how it starts

👍︎︎ 1 👤︎︎ u/pichael288 📅︎︎ Sep 13 2021 🗫︎ replies
Captions
hey everyone hope you're all doing well today i want to do a little bit of a relaxed video no script really just chill i recently got access to openai's codex which if you haven't heard of this this is essentially a model that can write code by openai so you tell it what you want and it writes the code now previously they had released another model i think it was yeah github copilot and i've actually been using copilot quite a bit it's like a code completing tool and it can write a lot of code for you and it's actually been very helpful now this and i have the playground open right here this is their new model davinci codex this is the strongest one it came out i think a month or two ago but i got access a week or two ago and i thought you guys might be interested i know my my last video on this lots of people tended to like so i thought we'd just kind of take it for a spin and see what it can do so specifically i want to see if it can write ai code previously when i tried out copilot on writing out actual ai code it did like okay you know not super great but not super bad i had some errors i needed to fix but i could sort of walk it through the process but this time we're actually going to be trying a bit more so let me let me start off with an example here instead of droning on about this so if we put like a little comment here let me go ahead and zoom this in for everyone watching if we zoom this in hopefully it's big enough we can say something like print out hello world and you can see i've set this to python down here you can actually use lots of different languages which is quite nice so if we just submit this hopefully it should complete our code for us and we get it several times and we can adjust the parameters here for example we could have made the response length less for this but that's essentially what we wanted right we can submit that and then what i'm going to do after we submit it is i'm going to pull up visual studio code so you see here i have a visual studio code tab pulled up so whatever this generates in here we can't actually run it so i'll just copy it over to here and we'll try running it just to make sure this stuff actually works after we give it a little look over so for example here i can copy over this print world and we can go ahead and run that just like that and we can see we got it hello world very nice very nice so we're actually going to start off right off the bat with something not too easy though now we're going to start off kind of simple and get a bit harder so if you do want to just skip to the harder stuff like classification and real ml stuff do feel free to skip ahead but you know let's let's make sure it works before we get to that because we might not get to that part of the video i don't know so we're going to make a block comment here and what i want to try and do first is create an example of linear regression so we can define this by saying create and i haven't tried this in advance by the way so i don't know if it's going to work or not so create an example linear regressor using pi torch using pi torch will make it a little bit easier so we'll give it a little handicap uh create the x and y uh i guess input and outputs the next thing we're going to need to do is create the weight vector as a tensor and then the third thing is run a learning loop and fit the regressor with we're just going to use a stochastic grading descent not that we would need to but it's just an easy way to do it we should also test the accuracy and print the results now again i'm a little scared here here i did play around with this a little bit but i haven't really done anything that's complicated so let's move up the response length as you see here on the right if it's too low we're not going to get a full thing what i'm not sure what's really good maybe we hit it up to actually we can we don't have to go that high because if it doesn't generate enough we can always just hit submit again now these other things like the temperature and stuff it's probably for the best for now that we just don't change that and go ahead and see what we get let's see import torch okay okay x's and y's oh wow wow it's doing a lot of stuff it's commenting for us too very nice so let's let's go back and see what it did so if you don't know what linear regression is um well i'm not sure this is the best video for you but a quick explanation it's just trying to take in these variables x and trying to learn a function a linear function that maps under y so in this case it looks like it created four inputs each one goes to two two to four three to six and four to eight the this is clearly you know they're just multiplying the x times two to get the y makes sense now the weights it looks like they're being initialized to zero required degree that's good seeing a learning rate uh creating that stochastic gradient descent optimizer defining the loss as mse that's good that's what we want and looping for 1000 iterations so it clears the gradient what's mm i believe that's matrix multiplication which would be right we get our prediction put it through the loss function and then do back propagation and this um this looks right to me i think i think this is correct so let's go ahead and we are going to paste this in here and i i'm curious if you haven't oh i wonder if i can zoom in for you all there we go uh sorry this is a bit clustered up here uh so take your guess in the comments before each of these what you thought before you you actually saw me ran these i think it's gonna work so let's do python test.pi now if it does work we should say what will we get well we'll print out the predictions and the predictions should match right they should match what we have here or be very close to it and then the loss should be as close to zero as possible and the weights i don't know what the weights will be they could oh i guess the weights will just be two right we'll hopefully get a let's see the weights we just have one weight so this is actually interesting right one weight means that there's no biases here so that's not ideal but technically this is still well is it i'm not sure if that's still lin i guess it is still linear regression oh no oh no this isn't good we ended up with n-a-n i wonder why that is actually let's try looping for less steps maybe that's the issue although i still don't know oh oh my that's quite the way yeah these weights are just absolutely exploding what are we trying to do we're trying to lost that backwards loss function is in you see loss let me cut out real quick and i'll be back once i figure out what's wrong with this i honestly thought this was gonna work um yeah so i'll be i'll be right back once i figured that out okay i'm back and i did find the air it didn't take me too long and the error is actually very simple there's one error that makes all of this work when we fix it and that's that you see we created the learning rate right up here but we never actually used it down here so if we just go ahead and multiply this by the learning rate we should be fine so if we go ahead and run this you can see we get out loss is almost zero and we're printing out almost four almost six and almost eight so that is that's really good the issue was essentially that we were updating by too much and the changes were we were essentially bouncing back and forth too high too low too high too low the numbers just kept getting bigger and bigger so minor mistake oh you know i'll give it the pass on this this was this was pretty good i'd say now the question is can we do better can we do better so let's go ahead and delete this that's pretty impressive linear regression one minor mistake so what we want to try to do next is what i kind of had in mind is computer vision specifically using imnist now imnist if you don't know it i can look it up right now in nist data set it's a data set of handwritten digits and what people often do is they download this they look at the images and they try and predict which image is which or what number each image is based on the image itself so here i would predict a one here a three here a nine here a zero and so on right it's sort of an intro task for lots of people learning ml and that's why i thought it would be an interesting thing to do it's not too simple it's not like linear regression but it's not too difficult either so we're stepping up the difficulty a little bit let's download the imnist data set will be our step one two will be implement impla uh meant a feed forward neural network classifier using pytorch again we'll use pytorch because that's what i like then train the classifier on the mnist data to predict digit classes so we'll throw in our training data and predict digits and the last thing we'll do is test the accuracy of the classifier and i'm going to put here down the image dataset if not already downloaded down loaded now this is a bit harder not only because it needs to do this it also needs to download the data set now so i'm hoping it just happens to know where to find it it's a very famous data set so i'm hoping that will be the case to me to do that so let's go ahead and submit let's go ahead and submit so it does its imports again uh data set okay i see so it's grabbing it from okay let's let it finish let's let it finish okay so let's submit again we didn't get to the end it looks like okay this all looks like very familiar stuff they're doing it fancy with a data loader too almost almost one more time and oh it's evaluating too i didn't even ask it to evaluate so it's going above and beyond that might have been the end of it but let's try one more time yep that's the end so this is a lot let's go let's go through this just a little bit see what's going on so we have our imports we get a data loader now yeah datasets.net so this is built into the datasets uh module which i'm not surprised by as a matter of fact i'm sure i've used this in the past so then this is our neural network it looks like it's doing a standard fully connected network using linear layers that's fine i didn't specify for it to be a convolutional layer or anything and we're just passing it through passing it through do a log softmax okay makes sense should be just a normal song i'm sure that's fine i'm sure it's fine so we create our model then we have our loss our optimizer some parameters and then we load in our data so these are loaders did we not already do this datasets.ms so this is a dataset and there's a data loader okay a little bit different and then we loop through the epochs set the model to train let's see grab our batch data send it to the target device and what did it set the device to it's to device did it set the device to anything specific i don't think it did so i think that's an error we're going to run into but we'll see we'll see and what does do after that it does the zero grad throws the model sorry throws the data into our model calculates the loss and also keeps a running loss that's nice for i'm sure metrics then back propagates and prints out how it's doing then it puts into eval mode finally and yeah does an evaluation it looks like pretty much the same thing so this might work except for i'm not i'm worried about that device maybe i overlooked it but let's copy and paste this over here and see if it works let's see if it works what's the worst that could happen okay so it's downloading the data that's that's a good start it'd be hilarious if it like wrote some virus that we're making me up device is not defined okay so that's about what i expected we can go ahead and define that uh we can just say something like we're just gonna do device equals uh cuda hopefully i can record a video and do this at the same time i'm sure it'll be fine sure it'll be fine so let's see how this works now okay so that's not good looks like the match2 was on the cpu yeah okay i see what's happening here so we're creating our network right but it's not moving it to a device however it is moving the training data to a device so instead let's just do the cpu to make it easier that is a bug in this but i'll i'll let it pass if it works on the cpu map one and mat two shapes cannot be multiplied well that's not very good now is it let's see what it did so it did 20 times 28 to 512 [Music] and then so it passes it through the fc1 right and is that the right shape i think it's the right shape i don't know if they give it to us like this but we'll see i guess that's actually something we can check let's let's check the input shape of this that might be our issue so print x dot shape i have a feeling this is going to be the issue and we can see that the shape is 100 by 1 by 28 by 28 that is indeed the issue what we're going to want to do is say x equals oh and there's copilot coming in handy using copilot with uh with codex that's actually kind of hilarious so we'll reshape it normally i guess we expect this to come in for a comment but let's see if that fixes it need a dimension i wonder if this is because maybe in an older version it didn't need a dimension i'm not entirely certain actually but oh actually okay we got epoch one is is it already done that's kind of fast for doing it on this oh yeah oh the loss is going down okay so this this might be working this might be working i guess we would need a double check the loss is just defined as what cross entropy loss that should be good and for the cross-entropy raw loss we're putting the output and then the target yeah i mean this all looks good to me so let's give it a moment to go ahead and finish this i'll just talk a little bit about my sort of thoughts on the whole thing while we go through this because yeah codex codex and github co-pilot which came out in very rapid succession by the way have really been incredible i think when they first came out i was like this is probably going to be a ways away from actually you know being usable i was wrong i was quite a bit wrong on that front i've actually been using copilot over the last like month or two and you know it doesn't do the heavy lifting for me but if i just want to do some quick work or i forget like how a like what a or if i forget like what i know what i want to do but i forget what function does it it can be very easy to just sort of put in a quick little thing like a quick little comment and let co-pilot figure it out for me and it's it's definitely sped my my uh process up this looks like it's done though and we got an accuracy of 94 wow not too bad not too bad so what were the issues here there was the device issue that we didn't have and there was this issue of resizing the input but overall i mean that was really impressive can you know this is something that uh most computer science students if you're if you're like focusing on ai in your undergrad probably don't do something like this until your third year usually maybe fourth year some people don't even start this stuff until grad or where they go into industry so i'm not saying you can't do it much earlier i know high schoolers that work on this too so it depends but you know this isn't an easy thing to do so it's i'm impressed by this model i'm very impressed as i said i already use github co-pilot and i'm excited to see where this goes this has really sped up my coding and maybe that's a video that might make like an interesting sort of it might be an interesting video right sort of seeing how fast it speeds up my process so trying to cut something uh just doing it by myself versus with copilot let me know if that's something you're interested in seeing in the comments or if you want to see a follow-up on this maybe we can do some more complicated stuff for example machine translation or more complex like vision stuff like image segmentation if you're interested in any of that sort of thing or reinforcement lane whatever it may be do let me know but anyway that's all i have for this time so i just want to thank you all so much for watching and i hope to catch you next time
Info
Channel: Edan Meyer
Views: 14,227
Rating: 4.967742 out of 5
Keywords: openai, codex, openai codex, github copilot, AI, codex ai, machine learning, openai copilot, ai singularity, self improving ai, ai that codes, ai that codes for you, ai that codes itself, self programming ai github, meta machine learning, nlp, natural language processing, nlp for code, GPT, gpt-4, gpt-3, gpt model, machine learning model, python, openai codex demo, openai codex tutorial, codex demo, what is openai codex, how to use openai codex, two minute papers, ai programmer
Id: FC962DmVfSU
Channel Id: undefined
Length: 16min 52sec (1012 seconds)
Published: Sun Sep 12 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.