Lesson "0": Practical Deep Learning for Coders (fast.ai)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
um okay hi everybody um thanks for joining um this is a um entirely optional presentation which i'll call a lesson zero which is all about um how to fast ai it's all about how to get the most out of this course how to make sure you finish it and how to make sure you feel like it's been a productive time and the reason i'm doing this is because a lot of people who take the course when they get to the end of it they say to me oh it wasn't until i got to the end of the course that i realized how i should have done the whole course and now i'm going to go back and redo the whole thing over again and so i'm going to tell you about what the messages i've heard are about what people have found most the best approaches to making the course work i'm also going to go through the actual mechanics of how to get set up with two systems google colab and aws ec2 and i talk about why you might use one versus the other so a lot of people now as in many hundreds of thousands uh have gone through the fast ai practical deep learning for coders course and um many many many of them have gone on to create successful startups to write research papers with high impact factors to create new products at their companies you know it's a pretty well proven course at this time but there's also a lot of people that never finish the course and so if you're watching this it's because you've decided you do want to learn deep learning so i'm going to talk a bit about like what's what's it going to take for you to be one of the people that that makes this into a great experience um when i talk about the course um i'm also talking about the book so just to be clear there's there's a book that silva gujjar and i wrote which you can either buy from amazon and people like it happily or believe it or not you can read the whole thing for free um so it's called fastbook it's a fast book repo honestly i make basically nothing from the book so don't feel like you need to buy it to say thank you or something buy it if you want the book if you're happy using notebooks use the free one it's all good um so the book was actually written as jupiter notebooks and was we wrote something to turn it into a book book now the book also by the way actually looks great on kindle online as well as paper i know often technical books don't this one actually does and then the course goes through half of the book okay and so quite soon we'll do a part two which we'll go through the other half of the book plus some other new stuff um but basically each lesson covers a chapter or so of the book so if you're doing this course you'll be going through the book at least in the notebooks and you might want the paper one as well so here is the main thing that you should commit to right now which is to finish the damn course right and or finish at least half of the book um because everybody i think who joins comes in thinking okay i'm going to do this i'm going to do deep learning but if you when i look at our youtube analytics a lot of people don't finish okay so you just need to decide what day are you going to watch the course each week what day are you going to do the assignment what day like how are you going to structure your time to finish the course and maybe you're coming in deciding i i don't want to finish it which is fine right um you know and if that's your intention up front no problem but if your intention is to be a really effective deep learning practitioner you need to finish the damn course okay so so put it in your head that that's your goal talk to your friends or your spouse and tell them that's my goal get that social pressure that you're gonna finish it and you're not just going to finish the course but try to finish a project right so christine mcclavey is one of our fantastic alumni she's now at openai one of the world's top research organizations she built a fantastic system for creating new music with deep learning she used to be a pianist herself and i remember this discussion i told her um focus on making one project great and polishing it off and finishing it and and she did and and that project has ended up creating music which the bbc orchestra played right and amongst other things helped her get this extremely exclusive job at open ai so this is a clip from a um podcast with one of our students sanyon and christine in which christine is saying this is one of her key insights and so i'm going to be giving you a few key insights some of which are from me or some of them are from me via students but they're all like things i've heard a bunch of times and so this is one one example so finish the course and finish a project the project doesn't have to be something no one's ever built before maybe it's just like oh i really love that thing that person built gosh it would be a real stretch if i could build it too you know great or it doesn't have to be world changing you know so one of our students built something uh for his fiancee which was a cousin recognizer he had i think 14 cousins and so his fiancee could look at could take a picture of one of the cousins and it would tell them which cousin it was right in our first course one of our students built the app for the silicon valley tv show which did hot dog or not hot dog which was actually a huge smash hits like millions of downloads it was written about in the media and it did exactly one thing just to tell you whether or not something was a hot dog anyway or it could you know um solve medicine that would be fine too i mean whatever um so finishing the course means being tenacious and um one of the things i hear a lot is a lot of the um approaches people learn as they do fast ai around how to learn and how to study are useful more generally and in fact this is a quote from our book the number one thing i see the difference between successful deep learning practitioners and and not is tenacity okay and tenacity is on the whole something you can choose now something you can't choose is whether you find yourself in the middle of a global pandemic or you know somebody in your family dies or you come down with a terrible cold or whatever like obstacles happen right and so part of being tenacious is being understanding with yourself right and saying okay something's happened i can't do what i hope to do right now but then getting back to it right so part of tenacity is not about ignoring the bumps but keeping going after the bumps and maybe that's you know quite often i'll have a bump that's like a year long right but if i've decided to finish something you know at the end of that year i'll go back and finish it um it's so sometimes that involves me emailing somebody more than a year after they've sent me something and saying okay i'm ready to reply now and they forgot that they even sent me an email um okay so what i'm going to do now is i'm going to share with you a bunch of insights from this book called metal learning if you haven't seen it before that's okay it came out yesterday and it was written by a guy called reddick who is one of the top alumni of this course and um it's a book well worth reading because his journey is extraordinary you know this is a guy without a degree who couldn't code just a few years ago with a job that he found boring and he set out to to learn deep learning and um repeatedly failed to do so um but um radek is extremely tenacious and each time he failed to do so he tried again and eventually he figured out a way to do it and the way he did it was very intensely based on fast ai both the course and the philosophy of learning and uh he is a he is now a kaggle competition winner uh he was um the only uh non-san francisco person at qai which is one of the world's top medical ai startups and now uh he works at a new non-profit that is literally trying to translate animal language um and uh is is so he's kind of a good example like i always think it's good idea to have a role model and in the ai community there's a lot of role models and so here's somebody who's like both a role model for like trying failing trying failing trying failing and then you know finding some success and so um i'm going to show you some things from from his book um and a lot of his book is him him taking stuff i say and kind of casting it into what he took away from it some of it's his ideas um so one of the things we hear again and again from unsuccessful deep learning students is they keep preparing to do deep learning and they keep preparing to do projects so they study linear algebra they study calculus they study c plus they study all these different things they do a mooc and then another mooc and then they read a book and then another book you know and at what point are they actually going to start doing something so the fast ai philosophy is you start doing something week one okay so week one you need to actually train a model okay which is not to say that you're not going to learn theory you will right as needed in the context of getting stuff done okay and so if you do finish it right particularly if you finish the full two parts of the course right you'll have implemented basically all of fastai's library just about from scratch you'll know all about batch normalization you'll have benchmark various matrix multiplication approaches you'll know how to write bare metal gpu optimized code you'll understand how to do back propagation and the calculus of that from scratch you'll do all of that okay but it'll all be as you go along in the context of like solving a particular problem or understanding the next piece of the puzzle um so yeah really just reading books and watching videos um is not going to get you there the thing which is going to get you there is writing code doing experiments and training models some of you might not be that great at coding um fine okay that's that's a perfectly okay place to be and but you guys are going to find it the most challenging because being good at coding is the thing that lets you zip through quickly so rather than think oh that's a shame i'm not that good at coding yet this is actually an opportunity because now you have a really fun project to learn to code in so a lot of people have become good coders by doing the course because as you do the course you'll learn about a lot of computer science concepts like object-oriented programming and functional programming and mapping over a list and list comprehensions and gpu acceleration and so on and so forth right so the thing is though if you're not if you come across a computer science concept or a programming idea or a piece of syntax that you're not that familiar with that's a place it's worth pausing for a moment okay and making sure that you know that you do understand how that code works because the code coding is the kind of critical foundational skill this is a pretty good course for getting started with basic computer science it's harvard cs50 course which everybody at harvard does for computer science um to get started and that's all available for free online um so i would recommend well and so would radic start there um and so these quotes are all from redex book by the way and then the other piece so radek talks about this four-legged table of the things that are going to help you do your deep learning experiments more effectively and efficiently and these are the ideas like knowing the basic ideas around code knowing your tools so an editor jupiter notebook knowing stuff like git like how to save your work and and pull in other people's work and so forth and understanding kind of ssh and linux like how to access a server and manipulate it and do stuff with it so there's this great course called the missing semester of your cs education which was actually created i believe by students at mit who said oh everybody at mit is assuming we already know this stuff but a lot of us don't right so there's nothing to be ashamed of if you've never used git or you've never used ssh you know or whatever they're just tools which at some point in the journey most people just kind of have to figure out all right so this is actually a great time to do it and this is a great course uh to use to to help you get there and of course again the main thing is to to practice these tools so that's the kind of foundation around coding and your kind of development environment that the next big piece of advice um which we talk about a lot in the course and that redick talks about in his book is um sharing your work communicating your work um and writing about your work um this is something that a lot of people feel very uncomfortable like tweeting or blogging or whatever right um it's like who the hell am i to start writing about deep learning i've just started right well here's the thing no one is better placed than you to write for like what would you have wanted to know six months ago right so you now know more than you did six months ago and you'll know more in a week and more in a week or in a week and so if you're um got a background in say the hospitality industry you know you could probably write something very interesting for your colleagues in the whole hospitality industry about ideas around around deep learning for example uh or if you teach in high school you know you might have ideas that you can write down about what high school students might find interesting or teachers might find interesting so you know everybody's got something to say and the key thing is just to to write it down because that is going to help embed your understanding a lot better and it's going to start to build up your portfolio okay and so we'll talk more about that in a moment but a lot of people have found that this message of sharing their work has been a critical part of their journey of learning and of also building up their personal brand that has ended up getting them a job okay so what does it mean to do a fast ai lesson so a fast ai lesson is basically a chapter of the book or one video from the course or both so what does it mean to to do one of these lessons um assuming you're doing the video then it means okay obviously watching the video so there's a couple of hours right and then it means running the notebook which we'll look at in a moment um when you run the notebook you have the whole book with all of its code and all of its outputs there you're playing with it um you should experiment right you should you should try things out so if you wonder oh why is this done before that we'll try removing it try doing it in a different order if you're wondering you know what would happen if i did that but this to this other image try it right the more you can start to experiment the more you're feeding your brain with these kind of like your own deep learning happening in your brain input output patterns you try something what happens you try something what happens so after that the next step is to try to reproduce the notebook from scratch okay um now and you're going to have to look things up obviously but the idea is can you with a a fresh new notebook can you um can you go back and recreate some of those models retrain them or redo some of that data processing pipeline so try to like type it in yourself you know you can switch back to the answer as much as you like but you're really trying to start to actually you know fill in your own write write your own code and then what you really the point you really want to get to is repeating some parts of the lesson with a different data set which you collect or download now this whole process often takes people a number of times through the course right so often the first time through people might just watch each lecture and try and kind of run it and you know just get to the end to get a kind of a general sense of what's going on so people will often kind of go through the whole thing like three times and then come back and try to go further and further right so don't worry if you can't do all this right away um certainly in lesson one that's going to be challenging just take it as far as you can right and as you go along try to push yourself to do more and more and you can even go back to an earlier notebook and see if you can understand more and more of it so let's take a look at what that looks like so here's the course okay and here's the lessons which you can watch and then here are the places you can run the notebooks so there's two types of platform for running the notebooks there are notebook servers these are things that as soon as you click into it the actual environment we environment we use jupiter notebook will pop up and you can just start running it pretty much straight away so that is obviously the easiest collab is free gradient has a free tier and sagemaker is not free so we're going to look at colab today the other option is to use a full linux server and this is something where you're going to have to basically set up linux and install the python system and install notebooks and get the code from github and run the server and log into it with ssh and do all that that's obviously a lot more work you might want to skip it for now in like lesson one um but i would recommend at some point um you go through this path and the reason why is that in real life at your workplace or if you do your own startup or whatever this is what you'll be doing you will be interacting with a linux server using ssh that's running a gpu and you'll want to understand how it all works and once you're using your own linux server you'll suddenly learn about all these productivity enhancing tips and tools that make your life easier so um i'll be showing how to set up aws ec2 that's the amazon platform today um you'll find google cloud looks very very similar indeed um jarvis labs was created by a fast ai alum and this is probably at this stage the best value of the full linux servers um so that would certainly be also very much worth checking out one good thing about aws so a couple of things aws is currently the most popular platform for cloud computing so it's very likely that whatever company you're at or end up at is already using it um uh they're also pretty generous with credits for startups and students so even although it can set you back you know 60 or 70 cents an hour you might well find you can get a few hundred dollars worth of credits through your school um or even a few thousand dollars worth of credits um through their startup programs and so forth um so let's have a look at what uh colab looks like um so collab is uh it's it's wonderful how easy it is to get started you literally just click on the chapter so let's do chapter one and it pops up colab um you can pay i think it's ten dollars a month for collab pro to get like longer sessions and more likely that you'll get a better gpu but for most people you'll find the free version is totally fine one of the biggest problems with colab is that it's not persistent which is to say when i go to this notebook it thinks it's never seen me before nothing's set up for me the way i want it but we've set up the notebook so that the very first cell actually installs everything you need so if i click this little run cell button here it will run the cell although what i will do is i'm going to pop over to collab here and let's also read the steps here and actually it says here before running anything you should tell co-lab you're interested in using a gpu so if you find that um when you run a cell in uh in the from the course and it's going to take like half an hour or an hour or more it's very likely you forgot to use gpu the gpu runs things many hundreds of times faster so all you do as it says here is go runtime change runtime type and say gpu okay so now i can run this cell and this is all python code except lines that start with an explanation mark actually sent to a terminal okay so paper is something that installs python software and fastbook contains all of the python software necessarily necessary for the course and so it's going to go away and set it all up and so this is this like mildly annoying bit um you can then connect colab to google drive and that's going to be how you can save your notebooks and save your work as you go okay i'm not going to do that right now but if you go to this link that it says and it'll give you a code and then that'll connect it up to your google drive and so at this point now everything from the for the course is now available and you can see the whole book is here okay so here's the book and um you can open up sections to read them okay you can go to the table of contents okay and so eventually we'll get to this cell here which contains all the code needed to run a model so if i click run here is where it goes now um this is going to um it's amazing how much this little bit of code is going to do it's going to download um tens of thousands of pictures of dogs and cats it's going to um uh use a simple rule to to recognize the dogs from the cats based on their file names basically the way that this this has been set up is that you can tell from the file name whether it's a dog or a cat um it's then going to download something called a pre-trained model which is something that already knows how to recognize uh various types of images um it's then going to construct it's going to then going to train that model to make it particularly good at recognizing dogs from cats and then it's going to validate that model to see how good it is at recognizing dogs from cats using a set of pictures that it hasn't seen before and that's all happening so so far it's already downloaded the data set it's already downloaded the pre-trained model and it's now busily going through the first epoch which is to look at every picture once to try to learn how to recognize dogs from cats and and that's it the line starting with a hash are just comments um because this is also the source of an actual book there's a few like slightly weird comments that you can ignore they're just things that are used for setting up references in the book there's the caption so forth okay so it's now testing out i think that first epoch okay so it's finished an epoch and so far it's got a one percent error rate so after 54 seconds it has learnt to recognize dogs from cats with 99 accuracy and so yeah we're going to let that finish off so that's how we get started with collab okay and uh there's nothing else to to set up um now what you can do is you can open notebook and you can open a notebook from github and here is the fastbook repository and you'll see in the fastbook repository for every notebook there's a second copy inside the clean folder with the same name there's also so i was just looking at one intro there's also a clean 01 intro if i open that up you'll see that it's got exactly the same thing as the last one i was just looking at but all the pros is now missing it's just got headings and code also all the outputs are missing so the reason that we have this clean version is to help you with these stages here is our suggestion is once you've gone through the lesson and you've run the notebook and you feel like okay i think i get it is you open up this clean version and before you run each cell try to think okay why is this cell here what's it for what's it going to do what's the output going to look like right so once you remove all that context this is a good test for you to kind of get your brain going to think what was actually going on so this is a kind of much more active approach to to reading and recall and so then once you've done that and you've finished going through this at the bottom one thing that is kept is the questionnaire so at the end of every chapter is a questionnaire and so then at this point you should now as much as you can without looking go through and try to answer each of those questions they all have answers in the notebook in the book okay so you can you know if you can't remember you can always look it up but um you know if you can't remember that's a sign to you that like oh i'm you know did i skip over that bit too quickly like what what's happened that i've not remembered and then try to remind yourself and then go back and yeah finish the question there okay so there's a lot of pieces to help take this from a passive i'm just watching a video i'm just reading a book into a participatory exercise that you're a part of okay so um as soon as you can we want you to create something that's yours and so this is the easiest way to do that is basically at the end of lesson one once you're kind of up and running try to do it with your own data set and um if you go to uh forums.fast.ai which is something that you're going to want to be deeply familiar with because this is going to be full of people just like you other people who want to learn deep learning okay and these people are all asking questions and making comments and you can see there's like a lot going on all the time and so you can see here's the part one course topic and you can see there's 1.4 thousand topics there and each one is going to have lots and lots of replies um so this is where amongst other things you'll find if you search for it something called share your work here which has 2 000 replies and you can see links to and pictures of lots of examples of things that other people have done after the first week or two of the course and so hopefully that might help give you some inspiration okay and um it would be great if you could reply and add you know a picture or link to what you build and you'll see you know everybody is very positive to each other on the forums in general and in this topic in particular nobody's going to go oh my god i could have done that years ago right um people are going to be excited for you that you have now joined the ranks of people that have built their first deep learning model and i will be excited for you so as i said radek this is again from his book um expresses in his book a way of not doing fast ai which i have heard now probably hundreds of times um i don't know why this is so common but many many people do what reddit did which was basically to learn all these math things right so he started with calculus and then once he got to a certain point in calculus he found that he had to start understanding real analysis and then as he started understanding um real analysis he had found he had to learn set theory you know and you get the idea right if you want to learn all of math that's going to take a while there's a lot of gatekeeping out there that says like oh if you're going to be a real deep learning practitioner you have to finish you know a graduate level course in linear algebra here's the truth the actual linear algebra you do in in basically all deep learning is matrix multiplication and if you've forgotten what that is that is multiplying things together and then adding them up okay so what you need to be able to do is multiply things together and add them up all right so if you can do that you're good to go so yeah don't get you know you're not going to finish it if a you never start it because you keep preparing or b you keep thinking oh i wonder exactly what's happening here and you go all the way down to the bottom until you've found yourself in the midst of set theory right don't worry you'll get deeper and deeper over time but if you're learning mathematical theory you're not coding you're not experimenting you're not practicing you're not actually building deep learning models and if you're watching this course and your goal is not to build deep learning models you're in the wrong course okay and if your goal is to build deep learning models then don't do this so as radix says here it's as you train actual models that you're going to get feedback right and the feedback that a lot of people get is oh my god i can already train useful models like a lot of people are surprised at how early on they can actually get astonishingly good results okay so so you know jump in and be open to surprising yourself that you can do a bit more than you thought you can't do everything right away okay but but start that feedback loop of figuring out what do you know what can you do what can you get working what can't you get working so one of the key things that you're going to need to do if you're going to finish all of the course is become even better developer than you are now even better coder than you are now wherever you're up to and so to do this you need to read code and write code the ai source code is designed to be extremely readable so you can read that code you can obviously read the code in the notebooks um but yeah you want to be spending as much time as possible reading and writing code and particularly reading and writing deep learning code all right how do you find out what's going on in the world of deep learning and how do you get yourself on the map of people doing deep learning um the probably the best answer is twitter for those of you whose only knowledge of twitter is uh the kardashians and donald trump this might come as a surprise but actually to create this slide i opened twitter and i copied and pasted the first three tweets that appeared on my screen so one of them uh somebody has a discussion about costs and impacts of different approaches to labeling uh this is a fast ai alum who's a 17 year old phd graduate he's doing well who shows how to mix pipe torch and fast ai and then hillary mason who's a professor i guess not a professor anymore but now an industry um talking about uh organizational issues in data science so you know there's a whole world out there of um machine learning um on twitter and they're you know if you want to get your work noticed that's a great place to do it because really everybody everybody's there okay and if you want me to highlight your work you know that's where i can see it and i can retweet it so yeah twitter is a really good place to be if you're just starting with twitter and you don't know who to follow go to my twitter go to my likes and go through my likes and find tweets that you think you actually like that tweet too and then follow the person who did that tweet okay and pretty quickly you'll have a hundred people you're following okay and then you'll they'll retweet things and you'll find other people you like and before you know it hopefully you've got a nice big lot of interesting deep learning stuff to read every day at first you'll understand like one percent of it um which is fine but you know you're there you're in it and it'll be all washing over you and you'll start to find the people who write stuff you find engaging and interesting and you'll also find the people that actually you don't and make sure you unfollow them so that you don't have your feed have stuff you don't care about um so then beyond twitter you want to start blogging okay and again blogging is not about writing what you had for dinner okay it's about writing something that you of six months ago would have found interesting okay so you know more than you did six months ago so write that down um we have something called fast pages that makes it ridiculously easy to start a blog and so there's no reason for you not to you know at least create a blog there we go and one of the nice things about fast pages is you can even turn jupyter notebooks into blog posts so it's great for kind of technical ones so this is what a fast pages blog looks like this is a fast pages blog about fast pages i had to write fast pages in order to write the fast pages blog about fast pages um but basically and one of the other nice things it's all into it's all in github right so it's as as you're blogging you're learning more about git it's all written with markdown which is something that you're definitely going to need to know anyway so as you're blogging you'll be learning about a lot of the tools you need to learn about anyway um so one interesting idea for things to blog about is um this example from aman arora who is a aussie fastai alum who is now working at weights and biases which is one of the top ai startups in the world this is a really interesting kind of blog post what amanda did was he took a video that i did at the launch here of the queensland ai hub and he wrote down what i said um and that's an example of something that you could do if there are videos out there that you liked and nobody's turned it into a post be the first to do so um because there's all these benefits um when somebody sends me something saying i've written up this talk you gave i'm very grateful to that person because now my talk is now available in a second medium a lot of people prefer to read rather than listen to a talk um you know that person's taken the time to do this they've given taken the time to have me check you know their work um and kind of everybody ends up winning from this so i've seen with um aman's post about my talk it's got attention from people that my talk didn't so for example i noticed on my linkedin feed the ceo of data61 which is uh the csiro so the top data science body in australia highlighted it and said check out this post from aurora right it's like so this is like an example of the kind of stuff you can do it's like try to be helpful right and at the same time you're also learning so there's an example of an interesting kind of blog post which very few people are writing and so there's a huge amount of opportunity here for you to practice your your writing okay now um what is the difference between machine learning and other kinds of coding um ezra dex says in in this chapter of his book um the key about machine learning is that we can generalize we can uh train a model with one set of data and apply it to a different set of data and still get good results and everything just about that we're doing in this course is all about creating models that are going to generalize well and we're going to be learning about how you can measure how well your model generalizes so answering these questions about can we trust our model to be correct on new data that we feed it is absolutely critical to to every model that you build whether it be in a kaggle competition or a little prototype or a production model you're creating at work um one of the most important things here is creating a good validation set and this is something that you're you'll hear about in lesson one of the course um but you know i really wanted to highlight it here as did redick in his book um it's it's a really important idea is you need a good way to measure whether your model is any good so you need a data set that really represents what kind of data is your model likely to have to deal with in real life and um my partner rachel wrote this really great blog post on the fast.ai blog about this actually interestingly you know this was um kind of came out of a um a lesson that i did at the university of san francisco and then rachel turned it into a blog post and rachel's blog post has ended up much more influential than my video ever was you know so this is actually a good example of what i was talking about and she took it a lot further okay the next key thing that radek mentions and i totally agree with is it's hard to write correct machine learning code i always assume that every line of machine learning code i write is wrong and i'm normally correct about that it normally is wrong because there's lots of ways to be wrong and unlike creating a you know a context management app on the web whatever it's much harder to see that you're wrong you know you can't see that the name didn't get stored in the database or you can't see that the title isn't centered right often it's wrong that it's going to be like half a percent less accurate you know or your image is upside down but it's kind of maybe you didn't even look at it or got straight into sent into the system and you end up with something that can only recognize upside-down images or whatever so whenever you're doing you know whenever you're building a project make sure you start with a simple baseline right like create the simplest possible model you can that's that you know solves the problem so simply that you can't have made a mistake so often that'll be like just taking the average of the data or if there's two groups take the average of each of the two groups um or you know something that something really really simple and then you can gradually build up from there so another very common beginner mistake with projects remember we want you all doing projects is somebody in a project group will say oh i read about this new bayesian learning thing with these clusters and this you know advanced transformers pipeline and we could put all that together it's going to be better than anything before and they then spend months creating this complex thing and at the end it doesn't work now why doesn't it work well i don't know it's so big and so complicated maybe it's a stupid idea maybe there's a bug in one piece of it maybe that one piece there shouldn't be there but it should be somewhere else i don't know right that's not how anybody creates successful machine learning projects machine successful machine learning projects are always built in my experience by creating a simplest possible solution that gets something all the way from end to end first and then very gradually it makes it incrementally slightly better okay so keep that in mind right you might feel a bit silly when you build that first model that just takes the average of the data right but that's how that's how the pros do it that's how everybody that actually gets it to work does it so often i've had you know silicon valley startup hotshots come to me and ask me to like check out their amazing new startup and i'll ask them you know oh you reckon this can separate um you know sick people from well people or whatever have you taken the average of each of these two groups and compared that to your model for example and they'll say oh no and then they try it and they find out their model's worse right so you you need to know whether your model is actually doing something useful for projects one of the things you might want to do is join a kaggle competition um that might be the last thing you see yourself as doing is being a cargo competitor but actually this is one of the best possible projects you can do because to enter a kaggle competition even to come last you have to go through the entire process of downloading a data set formatting it into the right method ready for a model getting it through the model saving the output getting it into the correct submission format and submitting it back to kaggle right so getting a um a model actually up onto the kaggle leaderboard is really going to test out your end to end understanding right and once you've done that you can start to iterate you can start to make it slightly better slightly better slightly better so although in a lot of ways kaggle is not representative of the real world you know you don't have to worry about deployment you don't particularly have to worry about kind of inference speed stuff like that and a lot of ways it is closer to the real world than you might expect and then it really does force you to go through the whole process and also to think about engine about kind of planning your project carefully so um enter a competition with your kind of goal that i i want to win right now obviously on your first one you're not going to win but the whole point is it's a competition so you're going to try to do your best right and so to do your best join a competition that's early right give yourself plenty of time um and every single day try to make a small improvement um and then you'll find that but you know if you keep reading the forums on kaggle and keeping trying a bit more every day you'd be amazed at the end of the three months how much you've learned how much of the staff that at the start you thought this is i have no idea what's going on and then you'll realize oh suddenly i've i do know what's going on and you might find you get in the top 50 which might be better than you expected so that this is you know highly recommended at some point during this course is uh have a real go at a kaggle competition so at the end of all of this you might be looking for a job now this could mean a number of things a lot of people just want to bring some deep learning into their current job um and so you know that's if your organization's already doing some deep learning that might be easier than if it's not if it's not you might just have to start prototyping some things and try to build up some kind of you know proof of concepts internally or maybe you're going to try and go out and get and get you know get a new role as a researcher or a data scientist or whatever um most people are not going to be able to rely on their you know stanford phd to get them there right most people are going to rely have to rely on their portfolio so your portfolio is going to be all the stuff you build along the way it's your footprint on the deep learning community and that footprint is going to include you know think things like your contributions to the fast ai forums and your tweets and your stuff on discord i would say pretty much every one of the fast ai alumni that have come to my attention as being thoughtful and effective community members all have very very very good jobs now um and so like people really really notice this footprint right so your your blog posts your github projects these are the these are the things that are going to get you a job um they probably won't get you a job at a big company a big old company in a you know kind of standard established i.t job right that's going to go through hr and hr got it like they're not going to understand any of your github code or know any about your community impact they're just going to know about credentials right and you'll come up against somebody with a stanford phd and they'll get the job right but startups particularly startups from other people who've got similar backgrounds of which there are many are going to appreciate you or companies that don't really have an established ai group yet or the startup you built yourself well certainly appreciate you right um so it's um the the more you've got a portfolio and that you can show that you've really built stuff um the better and so start early um another reason to finish this first course is that it's going to allow you to do the second course and if you're doing this live um part two we're going to be doing actually a whole new part two um towards you know basically shortly after this is finished right so if you if you finish this and do a good job of it then you could actually be one of the first to do part two now um we've seen um how easy colab is to get started we've also talked about some of the downsides of it right it's kind of ephemeral you start from scratch every time you've got this kind of hacky stuff of saving notebooks into your google drive blah blah blah aws on the other hand is going to give you and google cloud and java slabs and so forth are going to give you a real linux server okay and it's going to cost you javascript is the cheapest about 40 cents aws i think about 60 cents u.s per hour it's not going to send you broke but it's you know it's not nothing but it's a good idea to to try it if you can and i'm going to show you how to get started there and what we might do michael is i'll do some q a while things are running maybe so i'm going to head over to aws ec2 okay so one of the tricky things about aws is they've got hundreds of products this is amazon web services and they all have names that are totally meaningless okay so you just have to know ec2 is the name of the thing that you go to to rent a computer okay so they don't call it amazon computer rental they call it ec2 so the first thing you need to do is you need to sign up to aws and one of the things that uh they get is a lot of fraud um so a lot of people try to use their gpus to mine bitcoin so you have to ask them uh to give you permission to use their gpus and that's called requesting a service limit increase um so you'll need to follow the steps here to ask them for a limit increase if you write these exact words with this exact formatting uh it might come through a little bit quicker if you're from a country where there's a lot of fraud um you might not even get this permission um um maybe jarvis labs is going to be easier i'm not sure javascript even has the fraud check so um anyway there's quite a few places you can you can try to get a an instance so if aws has a problem with your quota try somewhere else but generally speaking most people should get a response pretty quickly saying you've now got approved so for you doing this course if you're going to try out aws ec2 i suggest you log in and request this service limit increase right away so that you know by the time you come back tomorrow the next day it'll be done and so what i'm currently doing is i'm on course fast ai and i've got linux servers aws ec2 and we're following through that project process okay now um to log in to your server you're going to need to use something called ssh secure shell so this is something where on your computer screen that server's computer screen effectively is going to appear and the stuff you type is actually running on that remote server not on your computer um nowadays pretty much nobody uses usernames and passwords for ssh instead we use something called public key cryptography which is where you basically have a secret number which only you know and then there's another public number that you tell other people and basically there's a really cool math trick which allows um people to check whether you have the secret number without actually anybody without actually telling them the secret number and the process so that's called um so that's what an ssh key is so there's this thing called a public key and that's the number that your the code that you're going to give to anybody you want to be able to log into and then there's your private key which you're going to keep for yourself so you're going to need a terminal so on windows in the store there's something called the windows terminal which microsoft provides for free which is pretty good mac has a terminal that comes with it linux has a terminal that comes with it so i'm using windows but it'll basically look the same for everybody now on windows you need a ubuntu linux shell not a normal windows shell so to do that you need something called wsl windows subsystem for linux and that will give you a full ubuntu system on your windows computer it's again it's free it only takes a couple minutes to set up so there's a link to how to do it here so once you've done it um whatever whether you're on mac or linux or windows it's going to look basically the same right and so you'll create your ssh key by following the instructions in the documentation which is basically you run ssh keygen and it's just going to go through and create these two files so you just run it it creates these two files and so this is the one that we have to give amazon this is the one that we're going to keep for ourselves so following along the documentation here it says to click on services ec2 find key pairs here okay and then we'll go here import key pair and whatever aws and this is where we're going to find the that id rsa pub that we just created and you can see this here it is right it's just a big long code and it's fine you can all look at this this is public not secret this is a cool thing right there's no passwords and i say import and so now we have an ssh key and we can use that to log in okay so this is just all this is here's all those steps so renting a server in aws speak is called launching an instance so to launch an instance we'll scroll back up to the top to instances and we will say launch instance okay and it'll say okay what kind of thing do you want to run amazon linux or windows or red hat or whatever i strongly strongly suggest you use ubuntu and the latest version which is currently 20. so i'm just going to say select okay and then it'll say okay what kind of server do you want um for playing around there's actually one that you can get for free now it doesn't do it's pretty it's kind of slow right but for learning about ssh and linux and stuff this is actually a great one to use um it's no good for deep learning it doesn't have a gpu so if i go to g4dn that's the cheapest kind of good gpus we can get and i'll get the smallest one there g4dn x large and then i'll say next next um so how big a hard drive do i want um i'd normally say about 100 gig launch and launch and so now it's going to say okay when you log into this which key pair are you going to use okay so you just select the one that you just imported and say yep i i know that i have that and then launch and you'll see dale says this has now been initiated and it's got a code so this is the thing that i've just launched if i click on it here it shows me here's my instance okay um so as you if you haven't done much with servers and linux and ssh and stuff there's going to be this whole world of new stuff for you to learn about but this is an opportunity it's not a problem so if you're not familiar with things like ip addresses that's cool there's lots of tutorials around at the moment but for now just know this is the unique address like a street address that your new computer has and so we're going to connect to it so this button here will click we'll copy that address okay so we can then go to our terminal and we can type ssh and paste in the address and then the only other thing i do need to do is i need to say provide a username and aws always uses the username ubuntu for all of its ubuntu images so you say ubuntu at and then the ip and so if i now press enter we're in okay so now everything i type here is actually being typed on that remote computer so for example to list the contents of a directory i type ls okay so the thing i'm actually typing into here is bash a bash shell so bash is something other of these things you need to be familiar with and you can learn about it in that missing semester mit course i mentioned you know it takes takes a few weeks to get somewhat comfortable with bash it's a very different feel to using a gui if you're more familiar with explorer or finder or whatever but you'll find it you'll be much more productive soon enough because you can replicate things quickly you can script things you can copy and paste things and so forth anyway so here's my here's my computer it's going to sit here running until you tell it not to even if you turn your computer off your server is still running and that means you're still paying for it okay so one of the things i guarantee you're going to learn the hard way by wasting money is that you're going to forget to turn it off okay so to turn it off you're just going to go stop instance okay so you make sure you you do that all right let's see how we're going here so we've launched our instance and we ssh into it okay so um keeping a linux server up to date and running used to be kind of annoying but luckily i've created something called fast setup for you which makes it easy and all you need to do is copy this and paste it into your terminal and this is one of the really cool things about linux and using bash is like in windows or with mac finder you'd have pages and pages of click this and drag that and scroll here but i've just scripted the whole thing so i'm just going to go ahead and paste it over here and it's off okay now what this is going to do is it's going to fully set up this linux server it's going to make it automatically update with the latest software it's going to configure it all correctly and so forth and it's going to ask a minimum number of questions so i'm just going to show you the questions it's going to ask you it's going to ask for a host name so a host name is just a more convenient way to access a server and so you can basically write anything you like as long as it's got at least two dots in it so i'm going to call this dot coursetest.fast.ai for example okay and then it asks for an email address now the email address um is basically just goes well it's where it's going to send kind of error locks and stuff too so maybe we'll say info at fast.ai okay do you want to set a password probably do so hit enter for yes so i'm going to put in a password it asks you to type it again okay reboot automatically when required i'll say yes and that's it okay so that's all the information that it needed so behind the scenes what's actually happening here is it's grabbed the latest get repo from fast setup and it's running this thing called ubuntu initial and you know this is something you can check out if you're interested it's basically uh 125 lines of bash script which is going to set up your firewall for you set up ssh security for you set up your swap file for you set up your ssh configuration for you install all the software you need for you set up your logging and upgrades for you set up your password and host name for you okay so it's going to do all that and you know this is the kind of thing that if you you know from time to time you can just might think oh i'm interested in how x works and since everything is open source you can just go in and see how x works and at first none of this might make any sense and so you go oh all right let's pick something and learn about it enable firewall ufw oh what's ufw copy paste ufw probably not united farm workers uncomplicated firewall did jeremy mentioned firewall okay what the hell's a firewall and you know you could start reading right um and then you could be like oh maybe firewall tutorial often adding tutorial can be helpful okay so you know you can start to just jump in here and there okay don't get too distracted we want to spend as much time as possible training models but this is how we learn about our tools okay so this is now going and downloading the latest version of all the software that it's going to need from linux so it may be good time for questions if we have any michael what's your current opinion regarding swift and julia as replacements for python so swift is basically out now so google has basically archived the swift for tensorflow project so you can safely ignore that um yeah julia's julia's interesting you know i think it's a lovely language nothing has the ecosystem that python does so you know if you use julia you're going to have to figure out a lot more stuff on your own and you'll find a lot more hard edges but i do think at some point python is going to have to be replaced and julia seems like one of if not the most likely thing to replace it or maybe it won't be replaced by julia maybe it will be replaced by something else that's kind of python like jax which actually takes python and compiles it using something called xla into a much faster thing than python otherwise would be okay do you think that deep learning or more traditional ml or stats approaches are more useful for traditional industry applications right now um so before i answer that question i'm going to press y which is going to reboot our computer now that it's all updated and obviously when we reboot that that computer running at the aws data center um it closes the connection because it's busy rebooting okay so we'll give it a couple of minutes um there's not a single good answer to that question um um and you don't really need to answer that question because basically any time you want to [Music] try any kind of machine learning model on a problem you should try a few different algorithms and switching from a random forest to a gradient boosting machine to logistic regression to deep learning is you know an extra half hour so um you should just try a few different approaches i find personally for me deep learning is increasingly turning out to be the easiest thing to get started with and gives me the best results um for most projects i seem to do nowadays um but you know have a look at like cargo competitions from time to time there are still things where gradient boosting machines work better or very often people use both and ensemble them but yeah it's not a question that you actually need to answer you want to get to a point where it just takes you a few minutes to try another algorithm out and so you don't need to be wedded to one or the other so i'm just going to see if i can i don't know how long it's going to take to reboot so i'm just going to i just pressed up arrow to get back my last ssh command and i'll press enter we'll see if we're back we're back okay so this is finished rebooting oh actually this time it says to do something slightly different which is to add this minus l here this is the thing that's going to let us connect to jupyter notebook so i'm going to type excerpt to exit from the server and this time i'm going to add the extra bit of the command there we go okay and all right so the next thing is we're going to install something called mini conda mini conda is a very nice distribution of python the programming language a lot of people have bad experiences of their computers getting really confused with python packages and things conflicting and all kinds of stuff like that that's because pretty much all the major operating systems now come with a version of python that is used by your computer for you know important operating system tasks you should not be using that python to train your machine learning models leave that python alone right you should always install mini conda and which is going to give you your own version of python which has nothing to do with your operating system as you can play around with as you like it's really easy just you can delete the whole folder and create it again in like three minutes you can create new environments which is like little testing grounds you can try different things so this is yeah very strong recommendation is to make sure that you install even if you're just playing around on windows or a mac not on a server install mini conda it's cross-platform you can use it everywhere and use that python okay so minicon is now installed so we now have our own python setup so the last setup step is we have to install drivers for the gpu and ubuntu actually comes with something that figures out for you what the best drivers are for your device so this is just what this set here is and so i'm going to look down look here it says recommended okay so here's the driver i want okay but what i actually recommend is you use that but also the one add the dash server to the end that's going to make like not install the stuff for playing computer games and whatever okay so let's go ahead and run these lines of code this is the bit here see this is 460. depending on your graphics card when you run this you might have some different number okay but since i wrote this today it's still 460. so we'll go ahead and do that and this is going to help go ahead and install this oh um sudo sudo is a special thing you can add to the front of a command that runs it as an administrator okay so some things you know by default commands you run basically can't break your system right um where else things like installing new software um you have to tell it to run it as an administrator so and when you do that it'll ask you for your password and this is the password that you put in just just a moment ago in the setup there we go okay is there a section of the course that people skip over too quickly um yes um part two yeah not enough people do part two and the difference between part one and part two is the difference between um being a pretty handy practitioner you know who can who can do some pretty good work as long as it's in reasonably well established kinds of areas um and versus being somebody who understands how everything's put together you could you know if you're told to create a deep learning model on in a domain that's like there are no published models you'll be able to create one um if you understand how to create models which combine multiple different data types um you know you're it it's a it's yeah it's it's a really great thing to to finish and yeah not enough people realize how much is is there and just the later lessons in in general you know it can like after you've done three lessons you you are pretty handy and you'll feel pretty handy right but it's pretty easy to stop there because it feels like okay i get it you know i can train a model i get what's going on um and to be fair it does very dramatically kind of scale up in terms of intensity after that because in lesson four you'll have to write your own optimizer from scratch and you'll be getting into the calculus and stuff um but you know it it it is a big difference in terms of what what you can do and what you understand so i think in general you know not enough people are getting deeper into the lessons okay so um this is now finished installing the nvidia drivers normally at this point people say to reboot but there's actually a magic thing you can do which means you don't have to reboot and the nvidia provides something called nvidia smi which will tell you about your installed gpus and so if you run it and it pops up anything at all other than an error it means that you are you successfully have your gpus installed so in this case we have a tesla t4 um it's currently 36 centigrade in there and the most important thing to know about is that it has 15 gigabytes of memory of which we're using nothing at all and there are no processors currently running on the gpu so if you're finding something's going very slowly and you're wondering maybe it's not using the gpu you can always run nvidia smi and if it says no running process is found you're not using the gpu okay okay so um one more setup step which is we have to install all of the software all of the python libraries needed so pytorch fast ai um jupiter notebook and so forth and so i've created a package which has that whole lot it's called fastbook if you're if you've used anaconda or mini conda before you might be surprised it says mamba rather than conda you should definitely use mamba and not conda it's way way way faster so anytime you see something saying conda install you should instead type member install it's way faster okay so off it goes member is now going to install all of the we've got all this python software getting installed for us pytorch is well over a gigabyte so this is going to take a few minutes just because it has to download that that whole thing and yeah that can take a while so while this is going do we got any more questions michael do you recommend any software for experiment tracking so the most popular experiment tracking software would be tensorboard and weights and biases experiment tracking software is stuff which will basically um you can use a fasta callback and you basically will say train whilst tracking with tensorboard or train whilst tracking with weights and biases and what it'll do is it will kind of create a little database showing you all the training results from all the different experiments you've run um and create some little graphs of them and so forth um personally i don't use any experiment tracking software and the reason i don't is i found that many many many people just about everybody i know who uses them finds it incredibly distracting so the trick to training models is don't watch them train so if you've done an ec programming it's like don't watch it compile right go and do something else preferably set up your next experiment okay experiment tracking software just makes it so tempting to look at all the pretty graphs in my opinion um so i would suggest get it running leave come back when it's done and there should be a bit of reason you are running that experiment so check whatever that reason was right um having said that if you're really sure you need the services of experiment tracking software for what you're doing um and there are some things that genuinely need it uh then i think weights and bias is is the best at the moment i think it's really great and furthermore they've hired lots of fast ai alumni and they're super nice people so i definitely recommend that the um so that's all the installation so the last step is just to grab um the book the notebooks um and so you use something called getclone to grab a repository of code and this is going to grab the fastbook repository paste so you can see it's saying cloning this repository and so you'll now find that there is a fastbook directory so you can cd into it and there is our book okay um okay so i think something um on anaconda is going slowly so we're not going to wait for it to download but so i want to show the very last step but the very last step is to run jupyter notebook and then you'll be able to click on the url that pops up and it'll bring up something that basically looks just like we saw in collab but the nice thing is everything you save like everything you do will be remembered so all of your experiments are going to be there the data sets you download are still there so on and so forth so that's that's that so when you're done it'll remind you here to as i mentioned before stop your instance so you can either choose stop in this menu or you can choose stop here or personally what i quite like to do is to run sudo remember sudo is this thing that runs as an administrator shutdown halt now and so that shuts it down from here without having to go into the aws gui and there we go okay so if we look back at the um ec2 here in a moment this will switch from running state to stopped state okay so i think that's everything michael is there anything else we need to cover okay okay great um all right well thank you everybody for listening in to um lesson zero and um i look forward to hearing how you go with lesson one and seeing your projects that you create and don't forget to get involved in the forums if you do get stuck with something the first thing to do is to search the forums because out of the hundreds of thousands of people that have done this before somebody's probably got stuck in the same way before so hopefully they can answer your question otherwise feel free to ask your own questions and hopefully somebody will answer for you all right thanks everybody bye
Info
Channel: Jeremy Howard
Views: 21,599
Rating: 4.9733334 out of 5
Keywords: deep learning, fastai
Id: gGxe2mN3kAg
Channel Id: undefined
Length: 88min 6sec (5286 seconds)
Published: Tue May 25 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.