Coding Train Late Night 3: GPT-2, Hue Lights, Discord Bot

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] [Applause] [Music] [Music] hello I am live good evening good night good spooky night time it's Thursday it's a lovely clock at night and my name is Dan shippin and you're watching the coding trade late-night oh I have to tell you something I did not get to have a nap today you might be saying what's wrong with you what are you taking naps well I wake up very early in the morning and I stream very late at night and sometimes around 3:00 or 4:00 in the afternoon I let myself doze off for about 20 or 25 minutes but it was an especially busy day and there was no nap so here I am I'm very excited this is the last late-night livestream of the week I have a lot of things planned for tonight I will be here for you know an hour and when I say an hour you know what I mean by that but next week if all goes well I will be premiering the coding train morning show so this is my new plan at least probably for the month of June it's not June yet but I'm gonna try to get this going for a month too a week of late night 11 p.m. shows and a week of early morning 70 shows because those are the times of day when my children are not awake and I'm not sped I'm not with them we're here doing quite well in Brooklyn New York but my family we spend every waking living moment with each other it's a lovely wonderful gift to be okay so so we'll see how that goes so I want to get going pretty quickly our our in quotes says William Hillary thank you for that yes quotes hmm I have a delicious cup of ginger tea keeps me in check because without that ginger tea I don't know what I would be doing or saying at this time well we have to begin as I always do with every coating tape I think that I typically just mess up the words that come out of my mouth and they generally don't form correctly in regular time I think I have a new member but especially late at night when I haven't had my nap no nap today I remember when my children were young and they actually had to take a nap that was a glorious time when they when they actually did take their now so I want to thank our new member unknown admin unknown admin I appreciate the fact that you've just joined the coding train as a member for your membership you don't really get anything I mean eventually someday I will mail you some stickers and as the message I got from a member today said are you planning to smell those stickers soon it's been about six months it was a very kind and nice message and if you're that person or have that thought in your mind please join the discord I will post a link to it and send me a note there because just just in case you don't believe that I am going to get around it hold on pause pause pause and eat another sound effect hold on a second this is a terrible idea what I'm doing coming over here and I am attempting to move can you see me you can't see me you can hear me I'm over in the side mmmm over here I got there's some plates and bowls anybody want some soup nope okay by the way I have this really expensive microphone that I can't figure out how to get to work maybe somebody wants to help me with that okay here is my box I am going to open this and inside of it is this stack of envelopes with decoding train return address on them which is just a UPS store that I use that I have not been to in two months I hope you can send me an email there and even each envelope is a sheet of stickers and I have made new stickers which are on their way and I will mail these to you who who in the chat somebody in the chat has gotten the stickers from me right because I see CJ's they're pretty sure I sent the stickers to CJ say forgotten secrets I got to get those out I got to get those got to get those mailed this shirt Yas curved kurta is a thing they like over they I should read what they've actually said in the chat the pineapples are cool thank you I picked this shirt up in keyway I had a lovely vacation in Key West sometime last year I think I don't know time has no meaning anymore hmm hmm where were we right unknown admin the new member and so one thing that I can promise you one thing that I can provide for you a small solace in this unprecedented and challenging times is your very own random number and here it is for you I hope I haven't read it to somebody else because I promised that their unique I do not have 1 million members so yours on page 331 is one of my favorite random numbers it begins with a 7 it's followed by a 1 and then another one and six and into 370 1163 thank you [Music] and now I am not able to hire a writing staff to help me with my opening monologue that would be a wonderful thing but I was lucky enough to discover that I could create my own opening monologue with some artificial intelligence so I'm going to go to my web browser that you can't see right now and I have closed all of my tabs no I haven't I still have this one and I am going to open up my robot I need so I need a good I need some like robot music a robot theme for when the robot is going to speak to us maybe I can use something I have right now that would work robot robot robot this one okay the robot is here the robot joke writer what did the for-loop say to the while loop oh wait the robot is broken come on robot run run run [Music] let's see we're waiting for the robot ah okay it's running okay the robot is running and I will now hmm hello and welcome to the coding train everybody do boy are my arms tired oh wait I'm so late I just flew it no I didn't fly and what did the for-loop say to the while nothing it just said stop working [Applause] why is my code not working it just keeps changing what does a sync do it reads its lines and prints all the time I guess I should probably this might be more effective if I showed you what's actually on my screen why why is Java the best programming language of all time it has the capability to program in a number of working s eyes so what's the good this is really good what's wrong with me tell me oh great joke bot generator dad blocks out my sleep okay I've wasted your time for about ten minutes I'm going to continue to waste your time if you keep watching this it's too bad that CJ's in the chat and not actually live streaming so I can't tell people to just leave and go watch CJ's Channel I did make some notes to myself here of a couple things that I wanted to share with you so one thing I should mention is at the moment everything that has to do with this new series which might it's probably gonna be canceled as of tomorrow if we're being totally honest here is in this particular github repo coding train slash late night on github and so I've been filing some issues of things that I want to get to I'm this is one thing I have to do there's a major audio glitch how many where's my so my lav mic has two bars I'm using the same battery I've rechargeable batteries from last night I figured I should let it like drain out the problem is when it drains out it causes an enormous amount of horrifying horrible static that's very loud in your ears maybe keep your volume a little down so that's one thing I want to fix something that I really want to do that I would gladly take help on is I want to create a readme file for each for each episode because I'm doing a lot of stuff in them YouTube apparently has this new feature that if you put time codes in the video's description it'll create chapters so people coming back later could actually find specific moments I haven't done any of them and thank you so much to Tiki head on github who started creating one for me and let me just move over here so you can see it so here it is and one thing that I would say these are super useful and actually that's probably that's what it should be in the time code but what it really should be if it's okay with you is if I go to edit the time codes need to work like free to be YouTube compatible like this start you know like animation you know start like you know start of stream so something like that this is the for you can't see cuz I'm really not I need an AI to like put me in the right location and now I go back over here so this is what YouTube wants for the formatting although actually what I think would probably work best is to do something like this because then it'll work in markdown but then when I cop when I go it started than when I go in copy paste so I don't want to belabor this that's misspelled I'm gonna do actually just cancel this thank you so much Tiki head I would encourage you to to learn to make your first pull request if you want to try that it would be an exciting thing to try you could create a new file in the repo put this stuff in it and add as a pull request and I do have a video series about doing your first pull requests on github alright so that's one thing that I wanted to mention so you can you can start to look in these issues for things that you can help with I also want to take a look at a couple links that I wanted to share number one I'm planning to do a collaboration video with an old friend Seb Lee de Lisle who just created this video has our YouTube channel just created this video about making this interesting hardware project that is a DEFCON indicator and if you watch all the way till the end you can answer a question to get it as a giveaway but apparently it's not gonna give it away unless there are two thousand I mean I he might give it away anyway I don't know what he's planning to do but two thousand likes so let's see if we can get the coding train energy over two subs channel and see if we can get that I know and there's you know at the moment just 270 of you watching and probably 267 of you are bear but you know go over and check that out I also wanted to mention I work with the processing Foundation which is a nonprofit organization a lot of community and open source initiatives that we do one of one of the things we do is run a fellowship program and I am the mentor for the fellowship program and this this season fellowship season I'm mentoring Erin Devi who started a new twitch channel called cozy coding so I mentioned a lot of switch channels i I have like lots of twitch fomo I feel like it should be on Twitch but I just get you know maybe I'm too old for twitch which is obviously not the case but that's my like pretend excuse and I just wanted to mention Erin's new channel cozy coding I've been watching the streams trying to participate really wonderful beautiful cool like visualizations that she is making this was in the most recent stream I mean that you'd all the way on this very low resolution image but I really encourage you to check out I don't know when she's streaming next but check out cozy coding alright it is late at night and we have got to get some of our work all right so one of the reasons why I haven't green-screen myself yet because I do have a green screen I could pull up here is because I really want to work with these hue lights and I want to allow you the audience to control and set the color of my you light so that's something I am working on if you want to know what I'm this music is very distracting to me right now I'm gonna go back to the readme here and these are various things that I am working on so the midnight pump guy should uncheck this is the midnight pumpkin alarm it needs what it needs actually let's let's fix this let's edit this it now in progress but it needs style Gann pumpkins so that's something I need to work on but the thing that I started last night that I used which clearly I need to work on some more because it's the greatest thing ever is my random doc death I should get like a jar and every time I misspeak and say a word incorrectly I have to I don't know put a coin in the jar and I could donate the money to charity I want to work on my dad joke generator so this is really actually practice because ultimately one of the projects that I want to do is train a GPT to model on all of my YouTube transcripts so I'm gonna have to do some scraping or use the probably just actually the YouTube dia the YouTube DL which is a command line not a scripting module thingy that I can download videos and audio and subtitles from YouTube videos so that actually probably pretty easy for me to get those transcripts but so what is GPT - that's a great question and maybe somebody out there in the universe could be a guest on this channel to try to explain it let me actually give you a nice resource that I did I recently see GPT - Runway ml YouTube pretty sure the runway actually has a video called generative text training with GPT - so I'm gene Cogan I believe appears in this video and explains a bit about how it works in Runway and what the gp2 t22 model is I might refer you to just briefly something on my channel that I have discussed called Markov chains a Markov chain is a probabilistic well I said I think I said probabilistic correctly a Markov chain is a way of looking at a sequence of information for example what's the weather like today and then tomorrow and the next day and the next day after that or how do you spell the word hello or what are the notes of this melody all of those are sequential pieces of data and looking at how elements of the sequence appear next to other elements the free that in the frequency of how they may bring elements appear in that sequence so you could look at text as saying like well every time I write a T in in all of the text that I've ever written there's a 50% chance the next letters an H a 20% chance the next letter is an A and we could do a statistical analysis of a large body of text and then generate text based on those probabilities that's what a Markov chain is my program but from A to Z or it's actually called programming with text on YouTube course goes over that in quite a bit of detail and follow-up to that is something called a car RNN so car RNN is probably was made famous from by Andrey Carpathia I mean I might be incorrect about this I don't know where the original paper was but a recurrent neural network is a neural network that deals with sequential data so it uses the mechanisms of a neural network to look at to predict what element should appear in sequence after another element and so ml 5 which is a JavaScript library that I've been working on and I've done a videos about and the channel has a car RNN module and you can train your own model and you can do examples and I've done stuff with that and Nabeel Husein who is car RNN I think we'll came on as a guest on and by the way L STM stands for a long short-term memory it's a variation of a of an RNN that does some additional stuff inside the little neural network modules little brain pieces little neurons they have some little extra good degrees deliciousness in them do keep I don't go into it right now also cuz I don't really understand it I'm in the wrong place I really like to point at exactly what I'm looking at so up there above me is a preview of Nabil going over lsdm so jeep GPT to the t is for transformer I forget what the G and the P is Oh Bert FB projection the chat is also talking about Bert which is a Google's natural language problem of this stuff there's a I'm actually one of the things I'm going to be working on eventually on this channel as with everything is looking at magenta models a melody RNN for generating a melody anyway all this it says GP t2 is the latest all the rage sequential data generator machine learning model and I kind of done a cursory glance over the GPT two papers I've watched some videos on them by no means I'm an expert in how it works but the thing that I think is most important to emphasize is unlike with the Markov chain and unlike I'm just going to move to this this view unlike with the Markov chain example and the actual car RNN example or LCM example those models or text generators were trained on data of my own only and that was the only thing they knew about to generate the new text GPT 2 is an art is a neural network architecture but it's it's most famous because I mean I'm sure there's a variety of companies and entities and organizations that have done this training but I think open a I might have been one of the first or if not the first trained own GPT too model off of a massive amount of text you know essentially like for all intents and purposes like the entire Internet and so it's a text generator that just knows what's you know has learned from a tremendous amount of text now all of that text is sort of just filled with all sorts of like biases and particular style that you know has to do with how people write in English in certain parts of the world from certain cultures so I think there's a lot to be sort of questioned about that but what I'm doing with this dad joke generator what I want to do is my scripts is not training a new GPT to model I'm taking the existing GPT to model trained off of the entire internet I'm not actually taking that one I'm taking a much much much much much smaller one it's so quite a large model but is much much much much smaller and fine-tuning it so what does that mean I'm giving it some extra text and saying hey just keep yourself going and like look at this is kind of like sort of some primary important information and so it's able to kind of learn from your text but keep but keep its understanding of how language works how the sequence of characters flow in the English language okay there was a lot of explanation but what's kind of amazing is this software that you can get from a company called runway runway ml I assume that's the URL runway ml machine learning for creators this was actually featured on I think the quarter cruise YouTube channel they did something with runway which is just like kind of blew my mind this is not a free thing this is downloading the software and tinkering with it is a fairly free ish and I keep meaning to I had a coupon code for awhile and I have to like ping a runway and get that coupon code again I might have some breaking news in the middle of this stream if I get I did ask but I'm so the founders of runway were graduates from ITP at NYU where I teach that's my day job and I worked with some of them closely and I've stayed in touch and helped advise the company kind of informally so I'm a little bit involved with runway but mostly it's just something that I love because what it's allowed me to do I actually before a runway had built into it let me go to just browse models and go to GPT - so these are oh look at this oh no this is me I'm like wait somebody already made one and then I rose it's me I was just wanted to look for the I don't know who's this film script generator I was looking for hosted models no that's this other thing I want to look at I'm lost anyway Oh remove backgrounds from people new we should try this let's try this choose input no I want choose input no I want video how do I get an input oh do I have to give it an image video mmm all right I'll look at this later it's just too much exciting stuff to play with that's to make depth from images remove background - oh man it's so much stuff to do this one is actually quite a cool model anyway so it's really just this wonderful library of all of these models that you could explore and most of these before runway came along if you wanted to run then you had to engage in a very long process of trying to clone a github repo and get all your settings correctly and maybe push it to the cloud because your GPU on your computer didn't work so this is a allows you to just run these models most some of them vary some with some exceptions you can run them locally on your computer run way is running on the computer but in most of them like I go here to this model that I trained most of them you have to run them on a cloud server and that's what you're paying for so you're paying for the time the cloud server runs okay now what did I want to say I was a long explanation that's 11:26 I better get to sleep at some point tonight this joke generator didn't work so well why because I trained it off a very very small data set so even though I'm just doing the fine-tuning I don't need to have a massive data set of the entire internet that I've done it and I'm you think that's somewhat facetiously just as a kind of just generic like big text data set uh you know be I think it's worthwhile to do the research of your religion stuff is what actually was used in the training process for these models but I want to get some more jokes all that is to say is that I filed an issue last night that was called knee more jokes and I'm gonna go over to that issue right now and people uh people gave me some jokes which is nice like I just paste those in manually which I think I will do but this is another official joke API but this is a so you know unfortunately I didn't actually look at any of this in advance so let me just before I click on anything let me just click over and see this looks very reasonable so I'm gonna come back to it so look at this this is reddit jokes that does not sound like something I want I mean yeah I mean stupid stuff sounds like something I want no I don't want blonde jokes that doesn't seem good Waka scrape from Wacha calm no come on I want dad jokes a little bit afraid to use these but I do like the fact that this is a hundred and ninety five thousand jokes that's definitely what we need where where where where if there's like is that waka sounds see available categories here let's look at this daily joke animal artwork blonde grows knock knock knock knock I could do not one-liners puns all right I'm good with puns children I could do is get hope that's not jokes about children comedy rating Gio can I just only get the g-rated ones that could be good and misunderstood music student we played the beatles last night jim student who won so could i possibly download okay I like this waka waka so I think this is good this is promising let's look at the waka JSON this is a seven megabyte file that's very promising let's download this file let's see doesn't have the rating in it that's sad I want the rating let's see what if I do how many jokes was in there what if I just pick kaggle short jokes I've got a new one from CJ let's take a look at that short jokes collection of 200,000 short jokes for humor research all right let's throw caution to the wind these look like they might be long and it's a CSV which is very promising I don't know what should you do before criticizing pac-man Wacka Wacka Wacka Milan No so this there I see the thing about this is I I really really really really I you know jokes can be a wonderful things and it's a really really fine line between a joke that is funny and a joke that hurt somebody's feelings but I absolutely very strictly do not want a joke that the AI generates and is gonna be very hard to do this just bull blanketly without any issues so I could I could I should have spent the time cleaning out a set of jokes and I could have just deleted ones I didn't want but I'm not happy with these okay we might get that much farther with this let's look at this rapid API Dada Dada jokes is usually pretty good okay unlimited supply of dad jokes for our dad jokes application alright so let's see version random jokes removed is this this is like a different API how do you make holy what see this is good how do you check if a web page try it out on Internet Explorer I'm being told oh for a couple things I've got some breaking news no not that one breaking news from the coding train member check violet tells me that computer file has a good series on GPT - I did not know that I'm going to have to watch that because maybe I can understand how GPT you two works a little more and so are you hearing the weird mic interference music is a little loud okay hold on this is all stuff I can fix sorry I didn't look at the chat I don't know what that interference is so my phone is sort of here but we'll just hope it doesn't become too distracting okay thank you I've now lost the YouTube chat let me try to get that back alright let's try to get a better so I'm I'm enjoying this random one this I'm sorry rapid API one so could I possibly get all these I can I just like download all the jokes unlimited supply like the idea of unlimited supply of jokes that's very good API calls getting started Joe random jokes count so jokes ID if they're actually numbered jokes create remove knock-knock type count alright so how do i how to test end points oh I have to sign up for a key okay that I can do subscribe to test oh there's some stuff I'm gonna have to do all right everybody let's make this happen I am going to sign up for this website I'm gonna get myself an API key and I'm gonna download all the jokes if somebody in the disc Court can do this faster than me and like pull request a file to my github repo that would be awesome alright internet watch Jake who's going to be faster at this you most definitely subscribe login sign up I'm gonna sign up with github that's probably a bad idea I'm gonna do it anyway I don't got a lot of time here yes definitely take my personal data yeah personal data it's good you can have it alright my full name is Daniel Shipman and my organization is the coding tree okay I'm in uh oh here's my API key everybody you can't see it I covered some of it up there's gotta be a way for me to regenerate that how do i regenerate it come on I didn't know we just show up so quickly database oh no that's its category I was hoping I'd just download it how do i regenerate my API key I guess I could just I guess I could just use it right now how do I copy it no to copy code oh this is like node code that's weird require uni rest I'm gonna use uni rest it's waiting for the Internet to do better than me I don't you can't see what I'm doing because I'm like I'm like panic by like not showing you my API key copy code don't worry I'm gonna show you some actual code in a moment so at the right now this is the code that I wrote yesterday that got all the dad jokes from I Can Has dad joke so that wrote all the jokes out to a txt file and I want to do the same exact thing right now so I'm gonna just comment all that code out I know you can't see it because I've got a obstacle you in a second what's the thing I should use just the thing I should use right the node module is called dot env it's not what it's called so now that I have dot E and V I'm pretty sure this is a thing that there's my API key again I guess I'm not on the screen here now you can see me let me go to we're gonna need to look up at the discord bot that I made with code and garden eventually once I turn this all into a discord bot so and I'm pretty sure this uses I'm pretty sure that this uses dot E and V excellent so I use dot E and source index require dot E and V config okay awesome awesome up there's my API key again don't worry I'm gonna get it private soon enough you don't have the end characters doesn't fit all f4 to generate read is that really true alt f4 I hope people aren't trolling me here in the chat let's try to regenerate it oh I was ok where is that ok alt f4 I don't even have an alt I'm on a Mac keyboard is that option f4 I got a touch bar you think there's an f4 on this touch bar are you insane do you understand what Apple has done there's nothing but USB see can i regenerate my API key by plugging something into the USBC port do you know how many dongles I have around here the cables it's insane what have you done to me was not alt f4 definitely not there's gotta be a way to command for no whew that just changed me to a new tab alright let me go back to my code it has the API key in it you know if I get banned alt f4 it's like it does something else probably closes the window of current application okay that was so sad how I fell for that I'm a very gullible friendly human okay I like to believe in people because you the viewers of the coding train are actually some of the nicest most thoughtful genuine heart inducing people of the world so try to stay that way all right now yeah what am I doing here dotty Envy where's my so now if I go back to the music still too loud by the way turn it down a little bit let me go to env sample okay so basically I just need to make a dot env file put something like this in it then I put my API key oh you don't see it so I made a dot env file this is my not real API key then I can go over to the code where I have my actual API key that you can't see you can't see it no just okay I think let's use the honor system everybody'd when I just say close your eyes close your eyes yeah that'll work I'll be fine so now I am going to paste well my lights are blinking ooh Jake has an excellent idea Jake Jake suggests can you do a tutorial on simulating magnetic field lines that interact with other magnet field lines north/south relationship huh the bread button at the top top left regenerates it okay okay this is a great idea right now I don't have a great system for suggesting topics the rainbow topics github repo maybe somebody can post a link to it there's a red button people are still oh so I'm being told this API has only has a get random joke endpoint and there's a 50 call limit on the free account plan all right timeout we're gonna have to start over and find our own dad jokes on the internet I mean getting 50 more would be good actually I had 650 so 50 more is 50 more I mean I should still get it but maybe somebody could just grab it's for me maybe I should go to the hue lights the troops were actually pretty good with my crappy dataset I just sort of thought you know while it's you know the first ten minutes of the livestream no problem I'll just download one of these suggestions and I'll have a new dataset no problem no it's just not how it works this kind of stuff takes hours it takes all day it takes weeks why would you ever think you could just like do it like I'm gonna do a one-hour coding show nightly and I'm gonna train a new machine learning model I'd scrape a dataset and clean the dataset in just like the first ten minutes let alone the first hour it's just not possible why does everybody say I look like this money heist professor because I have not watched that show is it good should I watch it I get that all the time all right I made a pull request for episode 1 thank you me jail run done thank you well that is wonderful I really appreciate that let's see if there's any activity happening here data set we looked at this one I mean I I think I'm gonna I think I'm gonna have to offline or in the morning show or like dedicate or do some research and get some more dad jokes and I think maybe what I should do is go back to what I was trying to do last night which is turn the debt the joke generator into a discord bot but even before that make it a glitch app so that I could create it as an overlay on my street all right anybody who wants to help and try to just collect a few more jokes let's go back let's go back to my code here where I'm gonna comment out this rapid AI which by the way have at it with my API key which will only let you do 50 requests oh I really should I think I have to just say oh I Jake that's so kind of you to do the super chance to highlight your question so I would I would actually do and I I really I think maybe that super chats as a way of answering coding questions during a live stream isn't perhaps the best way to sort of organize what it is that I'm doing but for a lack of a of a policy about that let me actually answer your questions and see you since you did do the super chat thing so I just posted a link to the discord and if you join the discord you can ask that question there and it's a wonderful community of people and I try to engage and answer questions there as well but the nature of code series especially the gravitational attraction one would probably be that can be modified to work with a magnetic attraction okay now let me get back to my laptop here we're gonna do some manual curation of jokes I hated absolutely hated that I all I did was just take the jokes and duplicate them a hundred times so I'm going to try to create a dataset that just has the jokes in there once let's run this one more time I kind of like just shutting my camera off by the way I find it like totally freeing but I guess suppose I should add myself back in here so let's take a look at this it's already open and we're going to go to jokes txt okay so here we got 693 jokes guess what let's add some jokes here's a way to create a dataset oh so everybody's saying that if you can only get 50 random jokes but there's more than 50 random jokes in the database a bunch of you could do this so any of you who can't maybe somebody can spin up a really quick script or just like and so a bunch of you could so if you can submit jokes now I'll take them so let's do that we're gonna we're gonna Crouch this is it I've got it I've got it I've got it we you and me right here right now we are going to crowdsource some jokes give me your jokes just don't post them in the YouTube chat or the discord post them here I think this one's good it's got a rainbow in it here's another joke okay oh don't use that okay oh well I'm gonna why does Norway have barcodes on their ships because they scan the Navy and oh I forgot that that shuts my music off okay that's a good one what's red and smells like blue paint red boy free API dad jokes random jokes West boss dad jokes ooh Thank You violet that's an excellent one West boss is reliable Oh hmm I'm gonna have to do some data cleaning on this whoo this is awesome oh my god these are coding dad jokes all right we can do some regular expression magic here I think all right so these are all bunch of jokes unfortunately these jokes only work if you get them so the Q & A ones I need to reformat them like this and I don't want the Q & A in there oh how can I do this with a regular expression okay so what I'm looking for fine and replace is I'm looking for it I want it to be a regular expression a line break followed by a line break followed by a colon and space and I want to get rid of all those boom oh I want the space so I don't want to get rid of the space okay so that did that now I don't want the Q I don't need the Q : I mean it's it's it actually will be awesome to have that in the data set because then I would have these like tokens that I can remove and I can know what's the Q and what's the a but right now I think for simplicity let's just get rid of that space place all okay so that's good so now I've got these jokes wait I don't get it password is - oh I get it now password is - a fortnight is two weeks okay now these are all oh yeah these are all G good so I just need to remove the line breaks now right yep all right oh this is good I just want a line that only has oh you can't see my regular expressions sorry I just want I think it's carrot is the beginning of line then like I just want lie and then that's end of line I just want blank lines which is this one how come it's only giving me this one no results oh can I just do this ah yes blank lines replace them all with nothing hmm that's not gonna work how do I replace them all all the blank lines is there a space there actually no is there a line break maybe it's this no that doesn't make any sense oh I can do this if the line breaks at the beginning replace them all perfect all right we've got 154 more jokes so let's go put that in jokes txt we're up to 850 jokes okay what else we got here github let's just you know before I click on these links here I'm looking at this these look on first glance on first glance these look fine like my name is bond James Bond so I didn't mean to have so many like computer jokes computer jokes okay oh we're up to a thousand jokes this is good this is the way to do it computer puns a giant list of puns have you heard of the band oh sorry have you heard of the band 1020 three megabytes they haven't got a gig yet oh I love that that is awesome a giant list of puns master puns JSON block this oh yeah a lot of these I already have so there might be some duplicates duplicates but this looks good you know you can't go wrong with a giant list of puns oh I'm gonna have to remove the blank lines again which was just beginning of line line break let's remove all those okay and let's go back to here pun punch line hmm okay I want to turn this into plain text I wonder if that's worth just doing here with a regular expression so for example what I want to get rid of is code to get the jokes so CJ has posted a gist that would be more helpful as a reply to that thread just because I don't have the disk or up on this computer although that's something I certainly could do Bob the Builder sat on a log Bob the Builder got off of the log to go home because he was tired I don't know that I'd get that Oh what do you call a bead that lives in America USB could somebody reformat me these jokes for me thank you I I don't I don't really want to right now what do you get when you cross a snowman with a vampire frostbite actually I was walking by a coffee shop that was where's my phone that was only doing a delivery obviously and take out today in Brooklyn but I took a photo of the joke that was on it's a sign and it was why is green ice cream so serendipitous it was meant to be I don't why is green ice cream so serendipitous it was meant meant to be okay I ignored a taped egg got is saying I ignored your link let's see which one is it this one good oh here we go my 50 jokes generated perfect thank you but that's very helpful but we need the script CJ if you wouldn't my I know I'm asking a lot but if you could make the script out put them as just plain text all in one line that would be particularly useful which I mean I should be doing this stuff it is I but you know I like this sort of crowdsource would you rather $400 or a matter baby nothing what's the matter with you I don't know that I guessed that I had a dream last night that I was a muffler I woke up exhausted that's pretty awesome let's see more puns pun this one I can definitely [Music] but okay no no no raw raw this one I can definitely clean with a regular expression so all I want to do is find [Music] the beginning of a line followed by a actually it's I don't even need a regular expression for this curly braket pun : quote so replace all with and nothing no wait why is that not gonna replace all oh because it's only the bracket on the first line sorry replace all and then I want to get rid of quote curly bracket comma replace all okay I'm getting rid of that one I'm just if I see some sort of like obnoxious offensive ones I'm gonna just delete them I don't know what this is this one [Music] okay so I'm trying to get rid of I'm gonna I'm gonna try to clean out these later more methodically but right now we've got thirteen thirty-one jokes it was an emotional wedding even the cake was in tears that's pretty good alright joke one no no no oh just one line yeah I see CJ's just one line alright we're gonna wait for CJ's fifty jokes I think we're actually in pretty good shape what what is the size of this text file right now desktop the text file is ninety kilobytes so we're cooking with gas now I think I got to get up to a hundred a hundred kilobytes to have anything reasonable let's see let's check our what did the duck say when he bought lipstick put it on my bill what you call cheese that isn't yours that's definitely in there because it was the punchline nacho cheese was coming up quite a bit you were supposed to say what is a matter baby don't get it how do you stop a dog barking in the back of the car you put it in the front okay that's good a dhp a DHCP packet walks into a bar and asks for a beer the bartender says here but I'll need that back in an hour I totally get it but I love it what do you call it nervous okay oh this is super helpful but I need these I need a script that just converts these to all one line up to correct format all right here we go a pun is not completely matured until it's full grown this is better than I could have ever imagined all right here we go here's 50 more jokes wonderful now so what you can do anybody watching this can if you want to try you can run this code that CJ wrote which just calls you need an API keys you have to sign up for that an API key like I did and then you just run this node code really quickly and you'll get your 50 jokes you know what what the what the hey ho I'm gonna run it with my API key that was somebody probably used already but let's see what happens so let's go this is weird so ridiculous what I'm doing I'm commenting out my code that went to the other API and putting this one in and I am getting my API key the one that you can't possibly get for me good luck getting that haha and I am putting my API key in here good luck getting that API key everybody and now I am going to run it jokes has already been declared what did I forget to comment out [Music] what's going on here what did I mess up constructs can't joke if joke jokes oh look yeah why that's weird that's actually a bug in the code for reals right Aaron my scripts like jokes too all right can I just do this oh I can't reassign it CJ's updating all okay might just change it to all that's a good way of doing it right just change it to all and then I'd say all ID right no oh no this still stays jokes but I'm writing out all okay great now let me run it see what happens you are not subscribed to this okay Melvin I had sent 66 more jokes boy this is amazing two men walk into a bar the third one ducks I got this one already what did the dog sing of the treat it google can't find the hurt okay okay hot boy is really trying to get me to understand this joke would you rather have four hundred dollars or a matter baby what's the matter baby nothing what's the matter with you okay I get it now I got it now what happens when a frog's car breaks down it gets towed away where are my jokes wait what happened to them did I delete them all oh because I ran the script overwrite the file good thing undo works oh my god I'm the worst programmer who ever livestreams late at night don't code and late at night go to sleep go to bed stay in school go to bed sleep a long time I think we're in pretty good shape here let's keep going sixty-six more Joe these are ok let's well let's do this all right let's grab these jokes trusting all you people where do young cows eat lunch in the cafeteria if if you walk in a forest and cut down a tree but the tree doesn't understand why you cut it down do you think it's stumped but we were still have to train the model why do Java programmers wear glasses because they don't see sharp I'm pretty sure that one's in there already but I love it I like telling job dad jokes sometimes he laughs gypsy dangerous got us some jokes all right save we are now almost up to 1,500 jokes hmm let's see what's our file looking like now 101 kilobytes that is all we need so now all we need to do is uh train our model time to train the model so I'm gonna go into runway move myself over here I'm gonna go to training I'm gonna train a new text model I'm gonna call this dad coding train dad joke jokes create I'm going to upload a new data set let's rename this file I'm gonna call it just for right now I'm just gonna call it jokes - oh I can't rename it right here whatever fine I don't care open jokes - is uploaded great and it didn't complain that I didn't have enough data thank you very much I'm gonna go to next I'm gonna say why did the chicken so this is an interesting thing to point out here which is that what I was talking before about how I'm doing I'm fine-tuning an existing model and ultimately it might be interesting for me to try using a medium sized model but it's gonna take much longer to train and I've got to go to bed and I do want to train what's modeled so I'm definitely to use the extra small model and you can see here that sort of grayed out is large and extra large so maybe those will become available in runway at some point I could actually start also training from another model that I've previously trained but let's just let's leave it at a thousand steps let's use the line as the data separator why is this overlay up there I gotta just get rid of that there we go and I'm gonna start training so great so this now is gonna take a while we are you if you watch the late-night show on Monday night you're very familiar with this calculating ETA so I'm gonna one of the nice things about runway so so this training process is actually not happening locally it's happening in the cloud and it's only available actually if you have a subscription to runway but so I'm gonna move off of that and I'm going to go and look at my list I'm gonna come back to it actually let's stick with this and while it's training let's look up work on some other I really want to do the hulex but I'm never gonna get to that let's let me close this stuff let's go back to glitch where last night I was attempting to create the dad like a little node app that would query the model I trained in runway and display it on a web page so that I could then have that web page permanently as an overlay and I could just be running new dad jokes or something so let's edit this project and let's see if last night a glitch was down so I actually wasn't able to even try to get it to work so let's go to show in a new window let's see if this comes up is glitched let's look at glitch status just to make sure it's up um well it's not a good sign degraded performance so excited to finally use glitch I had this perfect reason to use it and now it says degraded performance well degraded performance is better last night it was completely red this seems kind of like a degraded performance and Here I am thinking that maybe someday I could convince glitch to be a sponsor of the coding train oh well so that's not gonna work alright so I'm gonna leave that be I'm gonna come back to this another time I'm gonna move to trying to control the hue light that's really what I wanted to do and it's a reason for me to have my video on and not have a green screen so let's go back to that so I'm gonna go over here to terminal I am going to go to my other project which was called just lights and open that up and take a look at this code so one of the things I actually did do a little bit of research and here I go again with my secret username to control all the lights in my house I don't know that I've got some I don't think you can get in here with that and that I can reset probably but what I realized actually is this code from Tom I goes examples is actually the version two of the node hue API module and that's why it wasn't running it's not compatible with the version of the no to you API that I installed which is version 3 and now maybe version 4 even so there's like a shim type thing that I could get it make it backwards compatible but I think I'm going to start a bit but new again and I'm gonna go to this the the node so this is the module I'm using it's called node hue API yesterday if you tuned in last night it actually I'm able to control the lights just through simple HTTP requests but I think it's probably worth learning how to use this this node module which will just be a lot more powerful so let me look at this discover and connect to the hue bridge for the first time and let me see if I can you'll get this to work that's a lot of code and then I want somebody to research how do I set my how do I reset my hue and hue certain a secret username and a cub man cub man rights you should let viewers control your lights exactly so the plan is to have some sort of thing where I'm probably to start certainly just a discord bot so you could control them from discord but I might see if I can interface with the YouTube chat API as well or just create a website that people glitch app but people could log into and control the lights alright so I don't really want it I'm just gonna copy paste all this code into here and let's just see what happens I mean I'm node index such as the link button on the bridge was not pressed please press the link button and try again all right so now is the time where I'm going to walk over to the link button and press it and I should check let's check on the runway model by the way oh just 10 minutes remaining this is amazing it's training it so fast so we're gonna be done with this very soon that's awesome I'm uh I think you could still hear me I should check the battery yet it's still have two bars on my battery and now pressing the button doesn't seem to do anything when I press the button but says that's what I'm supposed to do I'm back over in my seat and why did the chicken it was tender I'm gonna go back here and run this code again all right user has been good now if I do this over and over again I'll will give me a new user like all this secret stuff will it do it every single time like different all right this is like this is the coding train in a nutshell you should treat this like a password there it is for you right there all right so I'm gonna see I'm gonna let's open up the let's open up runway I'm gonna go press the button again I'm assuming every time I press the button it generates a new user name and client key I'm gonna just hope for that so I'm going over to press the button again I dropped the microphone I'm so sorry I hope this sound is still okay looks like it's okay go press the button again and I'm coming back all right here I am back and I am switching to the camera now you can only see me you can't see my screen and I am now about to run that code again and I'm really hoping the bridge user and the user client key will look different oh the link button was not pressed so everything okay all right all right you're gonna I'm gonna leave this on and I'm gonna go try to press it again you know I just it occurred to me that I could actually just I happen to have a lot of computer equipment and electricity and networking cables right here where I'm sitting that I probably could just put the bridge right here and I could press the button as many times as I want we could see it through your glasses that if you can do that then please have at it all right I have a new bridge user and a new client key that you cannot see so I'm going over to the code and I am going to wait oh you can see okay I'm gonna I'm going to create a dot env file dot env and I'm pasting them in the dot env file equals client key equals client key equals so I have a dot env file that I'm now closing I am now clearing my terminal and now I can bring you back whoops to the code all right so in theory if I look at the code as long as I don't click on this dot env file as long as I don't click on the dot env file I should be okay so now what I can do is I can go to back to this website and the example that I want to look at is actually set a light state so so let me grab all this and whoops go back to here and this is sort of terrible what I'm doing but I'm gonna paste this in and so I'm requiring getting light States the user name is now do I say process env dot user name I don't know if that's what I called it so sorry hold on a second to go here I called it I called it just user so I'm gonna actually change it to username in the dot env file and so that's correct and I think I can show it to you but I think what I need to do is make sure dot env is installed so I'm installing the dot env module if only I could remember how to do it good thing I have that discord bot code somewhere I can close all these all these extra jokes and you keep this open for sure is this where I can find its just required dot e NV dot config so that's what I'm looking for so then I should just be able to have this so I think I'm good right because to get yes process env that's what it looks like I just say process T and V and I can get that other okay so that's secret you can't see it can't see it then the light idea pretty sure I remember from yesterday that the light behind me the ID number is five because that's something I searched for search get the IP address connect username light on blue new light state on I don't know what CT is the brightness is obviously the brightness is this like the hue or something satellite state state light state was successful okay let's try this all right unexpected token at where line seven okay oh that changed oh yeah that worked so what I need to look at the documentation alright let's look at the documentation light state API where's the API Doc's light state object so light state is on white it's a color brightness saturation on/off brightness hue so I can do a hue value CT what is CT mired color temperature ah so that's if it wasn't if it was one of these I guess I know what to call them they're just white lights but they have adjustable color temperature so I want to change this to hue and can I make an animation so first of all I don't want to do all this searching that seems crazy like why can't I just know in advance the IP address and can I also want to change this to a sink and a weight cuz all this let me see if I can rewrite this a little bit to make this understand a little more so I'm gonna do turn light on I'm just gonna write a function I'm gonna make it an async function called turn light on and in this function let's see if I can get this to work in a way that I can kind of understand it better so I'm gonna say search results equals a weight this so this is I guess this is like searching for the the hub or whatever the hue hub I don't know what any of this stuff is then I should be able to after this is done just say the host hears IP address so this is something I could do at the beginning and then this is a new function call where I want to say I guess API equals await this so I'm just again I have a whole set of videos about promises and how they work and then how you can use async and await with them so then what I want to do is I I can create this light state and then I can say oh wait I should be able to just say result equals a weight set the light state and then console.log light state was successful result so I'm hoping that this code that I've written that you can mostly see here is a little bit friendlier to look at and this is definitely something that I could just do once like basically all I need is to get the IP address which I actually know so like I know what the IP address is it I had it in the code I wrote yesterday and I've but I'll just it's finite it's a might as well search for it so now let's see if I say turn light on so let me first just actually turn the light off I'm going to use just the hue app so I'm now UPS I now just turn the light off so it's off behind me so now I'm hoping that when I run this code there we go okay I have to have to have to create a p5 sketch where I could just drag my mouse around and set the color of the light so but I kind of want to just try an animation first so what if I did for let I equals 0 like I'm gonna say H equals 0 h4 q H is less than 360 H+ plus I'm like afraid I keep like thinking the lights changing in some attacked okay and I'm going to do this and I'm gonna set the hue what I'm gonna set the hue to this H value now this is probably a horrific Allah bad idea because I think it's going to cycle through all the hues way too fast I'm gonna need to build in some kind of delay probably but let's just see what what happens did it run through all the different hues I don't think so well and I got an error maybe the hues aren't between 0 and 360 oh wait it's that's terrible to look for hue oh it's a wrapping value between 0 & 6 5 5 3 5 holy moly okay well that's interesting let's try commenting out this console.log actually let's leave it in there let's I don't see I don't even see it changing like to read it should be read right if I do this the light should be red oops no no semicolon there so how come it didn't change it to red what did I do wrong brightness values scale from 1 to 254 0 to 100 hue and let's just try this value anybody know why this is not oh it's green that worked so zero just wasn't red let's try let's try this should be blue that's not very blue Oh Thank You CJ is giving me my delay which is super helpful but I don't understand why the hue is not working well let's just do this Oh H is not defined whoops let's put this back in and see what happens now I'll see if I need a delay it seems like it has kind of a little bit of a delay anyway all right wow that's low I should actually oh and why did it crash - maybe I'm doing it too fast so first of all let me move this up by like 250 I want to see it cycle 2 different colors Oh saturation maybe I needs more saturation a dazzle a so I definitely want to add the delay which I can write a function delay by some milliseconds like Millie's I want to say a wait new promise by the way I'm not doing this code I'm looking at the code that was posted by CJ in the discord set timeout resolved Millie's think this is right this is a quick promise to do a bit of a delay and then I can say a wait delay 100 mil easy think I need these parentheses here it's one little let's see if this works Oh a so we need to say async function and also let's let's add in saturation so saturation zero white 254 is most colored I can also do it as a percentage which I much prefer to do so let's also do dot saturation 100 all right we're gonna give this a try everybody and I'm sure the machine learning model is totally done by now and I still have because I can't stop putting semicolons where they aren't supposed to be oh there we go okay there we go oh that is just wonderful oh I love this my node code is controlling it's like so so here's the question like what do I do right now I really should just go to bed it's 12:30 a.m. I have to wake up very early these children do not sleep in actually kind of do but I got to get up I have to walk the dog where's the dog Gloria come here she's sleeping over there yeah I have a little bed for her right here and I have a dog cam so what I want to do is create a discord bot I think I could do this pretty quickly and that's the thing let's check on the dad bot let's check on the the dead dad bot let's check on the the joke model it took 15 minutes the perplexity is at forty six point oh seven I talked a little bit about perplexity last night but basically I want a low perplexity and since I had such little data I'm actually probably ironically going to have a much better perplexity at this checkpoint of only 250 iterations through the training so I'm gonna actually keep that I'm gonna change the default check point to the 250th step so let's set as default and then I want to add this to my workspace I'll try later on let's try running this model so we're back to the jokes by the way which definitely means I need my time my laugh track ready why does my code not work let's see because it's not compiled and if you remember I can change the seed and get a different now I don't know now I'm just starting from scratch trace back github.com slash jacuzzi was my code not work one word inheritance too much good ok this is much this is way too good let's go to let's go to my p5 sketch I'd rather get it in p5 here because I can kind of do more what what did the for-loop say to the while loop I'll just leave you an explanation look I'm get some glue on the ends tie tie and call take a second to support [Music] this is like too good to be true I can't even tell you how amazing this is ok so this is good so we've got a couple things I can try here number one is I could you know very quickly I could make a discord bot that's not very quickly it would not be quick I mean maybe this waits till next week but the idea is to make or are you not hearing the laugh track it's just too quiet it's so much funnier when you have the laugh track let's just okay wait wait what did the for-loop say to the wild let's just say there's a second loop and we get a constant what's another good question I can ask what does a sync what did a sync say to a wait insert the line between a and a not look to a wait let's do it what is the fact that it had the parentheses there is pretty amazing what an a6 they don't wait call it a sync I don't know about that they sing yes do I see a second async/await do I want to hear a second AC put pieces feel like I'm glad you understand [Laughter] all right how do ID bug cuz my server is down why do you get checkout get checkout how do I think I've even thought about okay so this clearly works okay okay this is amazing and this is also amazing both of these things are amazing together now it's 1234 a.m. and I definitely should go to sleep and I feel very satisfied with both of these results I'm like well on my way to making these projects work the way I want them to but I sort of feel like maybe really against my better judgment I should just really quickly try to make it a a discord bot because then I could because I'm not gonna be back until Monday and I feel like it might be fun to play around with that a little bit in play around with this a little bit with the community and the discord over the weekend so first of all join the discord there's the link if you are you if you're a coding trade member there's some private channels so I'm let me see let me figure this out so thankfully thanks again to see the coding trade has now become to CJ have information on how I can do this great then I'm going to go ahead and do it so let me go to because this is just wait I'm having way too much fun to stop now glitch is still unfortunate I can't use glitch I will come back to that later let's go back to seed or the example discord bot which I don't know what happened to it and let's clone this reap so yes oh this is the problem with doing my live streaming from a fresh login that I've never used before so I'm just going to unfortunately I hate that I'm doing this but I'm not gonna authenticate this computer to github later and I'm just gonna clone it without being like authenticated and here and I'm gonna go into here now one thing that I need to do in order to make this work is I need to open and I would love I don't know if there's any admins right now in who are in the discord I want to set up a channel that the permissions are only I can post to it maybe I'll maybe let anybody with the supporter I guess I could do right now just anybody with the support or role can post to it but I want everyone to be able to see it is there anybody who's like watching right and I think David if you're still watching I know you have permissions but if you could set up a channel in the discord called bot testing thanks - so yeah the coding trade is that's a good one sponsored by CJ set up a channel and I'm gonna just go to just the camera here and I'm gonna see if I can if I'm not even logged into discord on this computer I just don't want to pull up anybody's private information by accident I can definitely set that there's that mode on discord which is like the stream safe mode or whatever what's it called what's it called if I go to my settings I can go to streamer mode enable streamer mode so I've now got streamer mode enabled so that hopefully the what I hate about this is right here on my screen or all my direct messages not the messages but the icons of the people and how many unread messages have I mean do and all the other channels I'm a part of like I don't want to show that is there where to hide that column and maybe I shouldn't care about this so much but okay David is on it so I'm going to wait for that to get resolved and I'm gonna start looking at the steps in that CJ outlines here so NPM i discord dot E and V so I since this is the since this project is already set up I'm pretty sure I can just do just do NPM install okay so that's good that should be done setup yes lint I mean you know it's not really my thing but I'm gonna I'm gonna I'm a completionist I'm gonna follow these instructions as written and I do want to learn more about this yes lint stuff and how to make it work properly I'm just gonna do check syntax and find problems right now I don't know what I'm doing I don't use react no help help where's my code run it runs a node right now it's JavaScript okay add the bots to the server I'll create a disk or application so what I need to do is open up the discord website and log in I think so far I'm good until I just don't want to just click to reveal thing so I think I can continue to I can log in and don't please do not okay do not scan that QR code I'm gonna do it myself I mean if you scan it it's gonna log into your account you don't want to do that I'll be logged in as you let me go and log in this is good that I'm do this that I want to make a sort of proper set of tutorials about making a discord bot but a scan QR code so I am logged in I think I need a little relaxing music yes log me in and now logged in [Music] and then I want to go to general go to the development okay so I can think I could show this to you so this is the developer portal and we'll turn the music down so this is the developer portal I actually have a bot that I made for the ITP program here so I can create a new application we're gonna call this dad bot I mean the question is am I gonna do the hue light I can do the dad jokes let's just do the dad jokes right now call it dad bot and so this is precisely what I don't want to do I could reveal it then I would have to regenerate so what I'm going to do is take you away from here I'm gonna click to reveal and copy it I'm going to go to the dot env sample file so now what you're seeing here is I'm in the sample file that CJ set up and I'm going to rename it to just dot env and then I'm going to paste in my token but I'm gonna pull the screen away from you paste it in and actually I I'm gonna need to do that the I just want the bot only to be in a specific Channel so I'll get that in a second all right so now what am I doing here I kind of have a renewed energy strangely enough but I just need to close that file and then make sure it's no longer on the I want to hide it please hide it okay it's hiding it so oh I can go back here okay so then I want to go back to the steps and add the bots to the server [Music] so let's add the bots to the server so oh right I do this but instead of whatever nonsense is here I go and get the actual client ID which is this and I paste it in here so I should be able to hit enter Oh auth application does not have a bot oh I think I did something wrong I might have done something wrong oh I need to actually create a bot silly me oh this is where is this the toque I'm so confused what's the difference between this general information client secret that's different than this token so so I also want that so let me just copy this which you can't see I forgot what the difference between these things are I'm going back to my env file debt that's not the bot token that was like the client secret which I'm going to not bother with right now I can get that again let me try once again going back whoops ah there we go so now now that I created that it's saying add this to a server and I'm gonna add this to the coding train server and I'm gonna hit authorize not a robot I think supporters is fine David I don't really I'm not I think it's it's fine whatever we're just testing it right now we'll figure it out later the other tab is for OAuth 2 yeah okay so now the bot should be in the discord and you know what I could maybe do is actually just go back to discord app.com and go to all right so now I need to go to coding train and is the channel available for me to go into and is the bot somewhere so I'm looking for the bot dad bot I know you can't see I really yeah there I see dad bot okay so everyone welcome dad bought who was waiting to board so I think I should probably alright let me show you what I've got here I think so this is the dad but now I remember when we did this before CJ there was a thing where it like somewhere during the steps it like asked me if I wanted the bot to be an admin I think I should just make it a conductor which is like the admin and I can get rid of this waiting to board so I think I just made the bot have permissions for everything so I think that makes sense to do right now so there's the bot and what channel am I supposed to be using David is it by any chance available in bot testing can I just use bot testing welcome to bots testing so let's just see if I can if I mention at dad bot there we go okay so I am now in the bot testing Channel and this is where I want to experiment with the dad bot right so let's look at the code and oh if the bots there oh I'm not running it let me try running it what do I just do a NPM start maybe okay the bots running so if I go back to discord thank you for this channel ID and if i zoom in on this a bit more and we say oh I don't have to mention how's this work I forgot what I do how's the example work I typed like this exclamation point something and it like both like 8-ball maybe oh oh the kit robes yeah different bot came to talk to me oh I probably I have to do the channel ID all right I've got to enable it to listen to this particular channel okay a server ID and the channel ID thank you I forgot about those steps okay so I'm going to update the in the env file the channel ID what is the server ID where do I grab that that must be a copy ID I think I've got it so I'm gonna show you this very briefly I'm zoomed in on it so this is this is what my env file looks like guild ID I guess for whatever reason discord the original term it's called a guild because we're all just living in a D&D campaign but the channel ID is for that particular about testing channel and the guild ID is the and then the bots token is on line one of this file that you can't see okay so now if I close this and come back to the file I should be able to let's try running it again and what are the commands oh I mean live chat here whoops bot testing see okay so I forgot what the commands are does anybody remember 8ball outlook good wasn't that one of the commands I guess I can look at the code command 8-ball oh it needs arguments ping let's try ping is a good test yay ping okay the bot is working perfect so now all I need to do is have the bot so I'm gonna create a new command let's go back to here I'm gonna create a new command I guess let's just use I guess the eight ball eight ball is probably the best one in terms of to start with so let's duplicate this file now let's create a new file we're gonna call it joke dot J s and let's paste this in and basically I want to prompt I think I I want to prompt right now so basically what I want to do is if there's no arguments I'll just do return and then the argument I want is well let's just test it out by saying prompt equals args index zero oh is it gonna be do I get can I get the whole sentence I forget and then message author and just a send back the prompt let's see if this works and then in index J s require commands so I need to add a command which would be a joke right just add this doesn't like it's very unhappy with all of my oh yeah and I say Const joke equals required joke there's a lot of Visual Studio code does not like my code at all [Music] and now let's go to ACTU bot testing and we rerun this and I'm going to say joke hi great joke what does the code do ah so so I need to join all of the arguments back so the each of those words are separate arguments I want the whole thing as a prompt so that's that's no big deal I'll change the code to say in joke KS prompt is args join I guess we're the space yeah because that's what's separating them so join with a space and then I think I can move on from here and I can go back to runway and I can go to network and JavaScript and I want to fetch I want to use tonight I think I used HTTP I want to use this so let's go into here so I'm gonna paste all this code from runway here this is an async function so I can say let's do I'm gonna rewrite this a little bit the options of what I want to post to runway are all of these things I want to get the response from fetching this URL with the options then I want to say the JSON I guess outputs equals a weight response JSON we're gonna do I'm gonna do though I'm gonna have to wait I'm not gonna be able to do the lights tonight that'll come next week oh wait fetch a weight response JSON output then I can say this this is just that object D structuring stuff and actually I really I only need the generated text I don't need this encountered end thing so I think I can do this oh really oh I'm just gonna say this now I'm going to say outputs dot generated text so I mean what's the chance that I wrote this code correctly oh so this prompt now is now this the max number of characters is what did I have it in the in the model itself when I was doing it here I guess it didn't say but I'll just make that you know whatever I'll make it 1024 let's use 0.9 as the top P and the seed I want this to be random so I need a random number I'm just gonna say R equals math dot random times 1000 and then I will say math dot floor so I think it needs to be an integer and that will be the seed and that should be good so if I get some if I get some arguments I will join all those arguments create the input to run way post this to run way get the response turn it into JSON and send the generated text its generated text back let me just make sure that's what it's called the output specification is generated text yep I don't I'm not worried about this encountered end property okay so now let me run the bot what's the chance this is gonna work is everybody still there David if you could make sure out what the permission should be that all supporters can post in bot testing and all members can view bot testing and then eventually will deploy this to the broader discord community okay so now I'm going back to discord and uh NPM thank you I've got a nice message here from CJ saying I forgot NPM install node fetch so thank you about that weirdly so let me install NPM node fetch and then where am I going here and then also I'm gonna need that where do I need the in where does the import go does it go here like is this right like if I put this here no I this needs to be on the actual this javascript file right let's hope this works whoops okay well that didn't seem to work oh I'm not running the model I'm not running the model so what error message did it give me interestingly it didn't give me a math and error message I mean the effect the request didn't go through that's fine no worries the model is now running and here we go we now have the discord bot all right I'm just gonna let you all read these to you let's see where can i what can I put myself maybe I could just unlock myself here very briefly oops and just move myself up here ok so please what does the rainbow do what does the rainbow do it relishes the light what is 1 plus 1 what is 1 plus 1 2 equals 1 2 equals 1 [Applause] why did the chicken cross the road why did the chicken cross the road made from hole okay hold on I've got to shut this down because I realize there's something really important that I need to do so I'm gonna shut this down I'm gonna I'm gonna stop the model from running because I want to host this model um this is a really important step here which is that I don't I don't want to have to refer this while this BOTS running I want to be able to deploy this but I don't want to have to like model runway application running here on my local laptop so I'm gonna host the model and the what I'm this is the model name generate batch I'm gonna press host model I am going to activate it is active and then now once again I have got to I want to I'm going to look at the code is I need to get I need to basically change everything that I'm doing stays the same the only difference is here instead of local host I'm going to put the deployed model what is going on here oh yeah model URL so I'm going to here we go I've got the model URL and then this would work except I need to authenticate and once again I'm going to manage to do we're gonna have to not show you my key so the only thing that changes here is I need an authorization token so I'm gonna grab that authorization token looks very quickly and so there's the token so let me just grab the what I need now which is the authorization token I think that's the only thing I need to add so basically coming back to what I'm showing you all I did was add an authorization line an authorization line which now will get the runway token from the dot env file but I have not put the runway token in the dot env file so let me do that dot env I want to call that what did I call it runway token and I've got to get that token putting that in the dot int so it's in the dot env file ooh weird okay actually I need to change it's gonna be all right oh I'm just gonna change something here so the runway token is in there but I also need to change something very quickly about the code which is this so I need to actually and before the token comes it needs to say bearer and then this is a variable and then end the string so this should work now with the deployed model let me make sure I can close this so this model is deployed at that URL I can confirm that if I go back to my if I go back to runway this model is currently not running in fact let me just throw caution to the wind and I'm gonna quit the runway app completely so I've quit the runway app completely and I should be now going to this hosted model and I believe by the way I misquote I think the price is actually one cent per query so it will be costing me a dollar for every hundred dad jokes so I don't know how long I'll actually run this but and I do have a lot of credits with runway that they've given me for free which I'm very thankful for but let me run this so now I'm running this again and I'm going to go back to I'm gonna go back to here so let's just see is it working or are you guys ahead of me test one two three oh oh I don't like that okay let me go back in valid JSON unexpected token or okay hold on I must have missed something let me go back and look I the problem is when I go look at the reference for what what code I need I've got to run run away again so what did I miss on that token is sitting there so I don't want you to see it so let me go to where the model is hosted hosted models it's active requests errors code so I can't show you the JavaScript because it's got the token in it but I'm looking at it oh no hmm I might have I think I see a possible thing that I messed up no oh yes I found it awesome so this is what I messed up I need to go to the query route so that should be query there that's the thing that I missed so you just double check that yeah okay so the quit runway again so that should hopefully have fixed it and I'm gonna rerun the bot ooh what yikes what did I mess up I D of not wait what what the did nobody test the bots for a minute okay ready and let's see oh that's so sad you can't see that it's still not working uh did I get an error whoops I think I want to take out all this console logging because it's do it I got to take out the console logging because I can't follow what's going on so we're because it's where is that console log here it is let's take that out let's go into joke KS and see make sure I'm getting the prompt it's console log the prompt just to make sure that's coming in and then para runway token this looks right oh no no no no no wait what's going on here no that's fine yeah this is fine I mean I'm just using single quotes and double quotes like a total crazy person oops but let me run the bot again and let's see what we got here let's see what error message we get joke what why is my code broken oh it gave me something back that's promising is it working and I just didn't get like a good result here joke why did the chicken cross the road oh it works okay everybody have at it and let's see let's see what kind of jokes we get then nobody post anymore what did the kitten say - what did the kitten say to the other kitten yeah I don't know how many programmers does it take to Khoda by yes but what if they change their minds we're getting a bunch of jokes coming in what do you call a dog that could do magic Harry I'm not talking magic because it knows about Harry Potter somehow I actually have a huge Harry Potter fan on why I press the boo is it oh it's 1:10 a.m. I'm gonna this is definitely the end we'll come back to the hue lights next week which is not a good thing for the morning show because it's gonna be so bright in here because the Sun will be in here but three people walk into a bar the bartender says two beers please one from one for the road [Applause] what can Internet Explorer do short URL I love waiting for these why is processing the best yes but don't change the color of the light bulb two programmers walk into a coding cafe they ask the waiter for a small donation towards their high school diploma the waiter says thank you sir an infinite number of mathematicians walk into a bar why couldn't the bike stand up by itself a tyre jamming the pavement alright everybody I'm gonna let this I'm gonna let this run for a little bit let's see can I I want to like get the full thing on screen here oh wait hold on whoops no okay okay okay think now alright everybody thank you so much for tuning in this is this the reach the end of this episode three of late night coding train where we're making weird AI fun projects I'm gonna let this bot run overnight against my better judgment I'm gonna hang out in this channel for a little bit after I shut all this stuff down but and I'm gonna leave this up so people can watch the discord and the different jokes come up for a little bit while I say goodbye so thanks again for watching and being here and I will see you next week I mean my tentative plan is Monday Tuesday Wednesday 7:00 a.m. Eastern Time unfortunately the morning show really will be limited to an hour because at 8 o'clock I have to go and wake up the children oh boy unfortunately I this is why we can't have nice things but thank you I'm gonna have to go and look through I might retrain the model and make sure that the language in there is all family-friendly okay so right now I think I'm gonna leave well I guess we could open up the permissions to after the stream shuts down we could change the permissions for everybody in the discord I don't want to broadcast and have the open permissions because you know I sort of I trust the supporter group and I all of you are wonderful people I'm sure who but you know every once in a while somebody likes to if they've got access to typing words onto a live stream try some shenanigans so thanks so much for watching and I will be letting this run for a little bit then I'll shut this off but I'll be in the discord for a little bit I mean I really should just need to go to sleep but I really retake you going with me of this experiment I hope this was fun for you feedback and thoughts is what are welcome and I'll see you I guess stay tuned the discord I'll announce there if I'm gonna be doing this late-night thing again next week or the morning thing next week or none of it at all next week so we'll see I love this new joke how did the AI cross the road yeah it was a good angle for me I don't have my laughs up all right so see you all soon [Music] [Music] I should say also just as a reminder it's my intention to release all of this code and everything that I've done tonight and the last couple days it's going to try take me a while to get the repo all organized and have everything in there and I would love any help or contributions in that regard okay thanks very much [Music] [Music] [Music] [Music] as always I always forget [Music] [Music] this stop stop stop I'm gonna do this stuff this stock this dog the star this start song never forget the Vista [Music] I'm gonna say once again coordinates [Music] coordinates [Music] and auto-tune and the internet will fix that [Music] coordinates [Music] coordinates unicorns and rainbows and cupcakes what else is there yes kids thank you very much kittens and rainbows and cupcakes notice that look what I get I really lives in my mind [Music] [Music] [Music] I feel just sort of like a nice feeling of relaxation everything's gonna be okay today dream is not broken it does not frozen this isn't this is a wonderful thing okay we're gonna do it I'm really getting something I need my sound [Music] what else is there unicorns that was invalid syntax I forgot all sorts of text generation analysis things that I will use continuously [Music]
Info
Channel: The Coding Train
Views: 34,095
Rating: 4.9081779 out of 5
Keywords:
Id: kWsDL-6D-nk
Channel Id: undefined
Length: 146min 25sec (8785 seconds)
Published: Thu May 28 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.