 Okay, so let's see how to do that paper space stuff that we did in the last session. But from scratch, like, step by step. And one very reasonable comment on the forum after yesterday's session was like, this all seems kind of complicated. And it is. And like, definitely one option is like, don't worry about it for now. But I would say like, trying to get this working is a pretty good exercise, actually. So, you know, it's totally up to you, but I, you know, I think it's, I think it's probably worth worth trying to get working and ask lots of questions about anything that you're not sure if it doesn't make sense or it doesn't work for you or whatever. Okay, so if I say share screen, here we go, share portion of screen. I've never tried this before. And I think it happened. Share. Move that. This is cool. Okay. Do you see my browser window? Yes. Yes. All right. Okay. I'm successfully sharing a portion of the screen. Paper space. Paper space. So what I did this morning was I just went in and moved all of my paper space set up in persistent storage out of the way so that when I create a notebook, it's going to be totally empty. So let's create a notebook. How did you move it out of the way? Oh, no, I mean, I just like I went into slash storage and moved the files, renamed them to give them a light extension or whatever. So they wouldn't be run and moved everything into a different order. That's all. So we are in the setup that we would also, right? That's the idea. Yeah, exactly. This should look like what you should all say. So I got to delete the workspace URL. So we have something totally empty, which I think is actually probably best. Right. And yeah, so follow along if you want. And if anything doesn't work for you, let me know. And then what I thought we would do is I like to learn as few things as possible because I'm lazy. And so the way to get away with being lazy and learning as few things as possible is to learn things which are really versatile and powerful so that they can like do a lot of things. So in particular, I haven't really spent the time to learn bash scripting very well. Because I have instead spent the time to learn to use Python as an effective scripting language. And I can also use Python for machine learning. I can also use Python for creating web services. I can also use Python for creating console applications. I can use Python for creating continuous integration scripts, etc. So that way I can be lazy and I like being lazy. It's one of Larry Wall's three virtues of a great programmer is laziness along with impatience and hubris. And I would like to be a great programmer. So I follow those principles. So let's try to use Python to kind of automate the things we want to do. So remember that I, you know, we're going to avoid using the weird proprietary GUI because we're lazy. We don't want to learn it and also because it's not that good. So I'm just going to open up a second tab. And so over here, I'll click Jupyter. And so what we should find is that we're in a totally empty spot. Here we go. So this morning I did do some reading of documentation, which is also a great thing to do if you're lazy because if you read documentation, then you can like find out straight away. How things work rather than spending ages trying to figure it out. And so the documentation for paper space was actually very useful. And it explained how their different folders work exactly. So in the root directory, probably be a bit bigger, I think, there we go. Actually, I think if I go view presentation mode or something, it makes it a bit bigger anyway. That didn't do anything at all. Okay, in the root directory, there's a couple of particularly interesting folders. Most of the folders you see here are the same that you would find in any Linux box, but the notebooks and storage folders are interesting. And one of the ways we know they're interesting is if I go DF minus H, which you might remember is disk free. It lists all the mounted disks in human form. It's made it way too wide so we can't really read it. Okay, I make it smaller just for the purpose of showing this. So the slash notebooks is actually on a whole separate 500 gigabyte disk and slash storage is on a whole separate 500 gigabyte disk. So what paperspace does is slash storage. And I think I put in there is going to be seen by every single notebook server I create. And in fact, if you've got, I think if you've got like multiple people in the organization, they might see the same thing as well. So that's going to be shared across, yeah, all any notebook server I create. That's going to be handy because anything I want to use on every one of my servers, if I put it in there, then I don't have to worry about recreating it each time. Something we didn't mention last time is slash notebooks is interesting. That's also persistent storage, but it's persistent storage just for this one server. So stuff that's in there, we will see every time we start up this server. If we delete this server, it's gone unless we back it up. So that's where we would put things that we don't want on every server but just on just on this one. You pay for storage and you pay, I think it's like 30 cents a gigabyte or something like that per month. And they don't limit you, except for the 500 gig limit. So it's up to you to be careful of that. You will find in your account, there's a section called billing that shows you how much storage you're using. So they will add up stuff in slash storage that just appears once and every single one of your notebook servers slash notebooks that will all be added together. Okay. So the first thing we did last time was we tried installing something extra from PIP. So one conversation that we had on the forum since then is like, are you sure that's not going to mess me up because you know, paper spaces installed stuff, I believe using condor and PIP and condor are different things for installing Python libraries. So, you know, is that going to mess things up and the official answer is, yes, it will don't do it. But the unofficial answer is, you know, we've got tens of thousands of people on our forums, and I've never heard of anybody in practice actually having any problem with using both PIP and condor slash member. So I'm just going to say don't worry about it. Yesterday, I think the only the place you really need to use condor or member is is for stuff that uses the GPU. And particularly for PyTorch or if heaven forbid you have to use TensorFlow. Yeah, so I'm going to say don't worry about it. And the reason we actually want to use PIP in this particular case is we want to be able to install the packages into a into our home directory into a different place. Yeah, the reason the reason we want to use Mamba or Condor for stuff that requires the GPU is that they have a way of installing dependencies, right? Yeah, they have a way of installing the CUDA toolkit requirements, so we don't have to install the CUDA SDK. It's basically the reason. And that's and it's not just like one less thing to install, but more importantly, it's one less thing to maintain. Like your CUDA version and your PyTorch version have to the mesh correctly, otherwise it will break. And if you just use condor, that happens automatically. But if you use PIP, then it's up to you to make sure you're installing the correct meshing versions of each things. It's also more challenging in a something like paper space because, you know, installing things like the CUDA SDK into your home directories. I don't even know how you would do it without using condor, frankly. Yeah, does that answer your question, Radek? Yes, thank you very much. Okay, great. So somebody's got a loud clicky keyboard, they should probably mute themselves. Yes. Hi. Hi. If the PIP installation do something wrong, can I uninstall or get to a previous state? Yeah, I mean, kind of you couldn't always just type PIP uninstall. Or just delete your member forge directory and start again. But you know, people always like, I mean, or you can just, you know, install a condor package over the top of it. Like it shouldn't really be an issue, generally speaking. The issue tends to be more if you accidentally install something into your system Python. Yeah, but the idea is that you want to feel like you can blow away your member forge or many condor or whatever directory anytime and recreate it. Yeah, because you don't want to be in a situation where things work, but you don't know why they work and you don't know if you can get them back to a working state again that's really unsustainable. But yeah, the short answer is you can just type PIP uninstall to remove a module. Thank you. What about when it says that some packages are going to be downgraded? That's okay. Yeah, that's okay. If it's going to downgrade packages, I mean, I'd kind of check how much it's been downgraded, but sometimes it'll be like one or two, you know, 0.0 to 0.0.0 to difference in version or something. It's not going to matter. I mean, if it's downloading it or downgrading it by a lot that might mean that something wrong is happening. But yeah, it's not necessarily a problem. Okay, so and I think like PIP almost never downgrades things. Condor does sometimes. So let's try. So the thing we learned yesterday is we can go PIP install, and if you want to upgrade something, it's minus you. And there was this one extra thing we typed, which was minus, minus user. And so, so the key thing that does is it puts it into our home directory. And so in our home directory, the place it put it is the dot local folder. So what the, so the thing we wanted to do was to make sure that the next time we start up our computer, we want that dot local to be there. So that means we have to move it to persistent storage. So that's easy enough to do by using move so we can move it into our persistent storage. And you know what I would be inclined to do actually is to create a folder in there just for the stuff that we're where you the things in storage that we're using specifically for like configuration like this. So I was just about to delete this line when I realized I haven't taught you folks how to delete lines yet. So to delete the everything left of the cursor, it's control you and to delete everything right of the cursor, it's control K so hit control you. And so let's create a directory for this. So we'll go make a directory in slash storage, which we'll call like I don't know CFG for our configuration stuff. Okay, and so then we'll make a sim link from so then we're going to move. Okay, so we're going to move our dot local folder into there. Now, do you remember the way to say the last thing I typed on the last line is is exclamation mark dollar. So I can say move dot local to slash storage slash config by doing move dot local and then exclamation mark dollar. And you can see it's filtered out here to show me so it's a quick shortcut. And then so I want to sim link that back again into this directory so create a sim link from slash storage config. And here is the default right so I don't have to say to here. And so you can see we've never seen cord dot local. And it's not a real normal folder it's just a pointer to this other place, but it acts like a normal folder. As you can see. And so that should mean that I can import fast core. And get fast core. That version should be one for three control D twice to exit. Okay. Everybody happy with that so far. I had a doubt so which part was the dot local actually there like in which folder was the dot local is in my home directory. And so see how here I typed CD. So CD takes you back to your home directory and you can tell where I am, because it's the bit before the pound sign and tilde means in my home directory. Basically everything it creates for like kind of your configuration will be somewhere in your home directory. On that term, we're talking about Jeremy. I noticed that when doing CD backs slash one CD space backs slash CD space forward slash forward slash. Yeah, that one. That went to a different place to the home where you guys CD space tilde. Yeah, so CD space slash text you to the root directory. Okay, so that's the top level where CD enter or CD tilde same thing takes you to your home directory. So, if I go to CD slash and I type print working directory it says oh you're in slash. And if I just type CD and say print working directory it says oh you're in your home. That's where root. That's our home. Normally the home directory is slash home slash username roots a special case. That answer that question. Yeah, thank you. Just a quick question Jeremy like in terms of starting your the instance that you just started is that without an image right. I used the fast AI image. But I used the trick that we learned yesterday, which is to go to advanced and then delete the contents of the get workspace. I clicked on create. I clicked on fast AI. Make sure you do choose the fast AI image because it's got all the stuff we need to make this stuff work but I then clicked advanced options and then deleted that. And the only impact of that is that just it doesn't put the contents of this get repo into your notebooks directory. That's the only thing. So I could try all these things that you're doing right now without, because I do have a notebook already created but it's with the fast book. Yeah, so you could like just delete them, you know, you know, just RM star.ipnb or just ignore them or yeah, absolutely. No worries. Jeremy task one more question. The, so now you've, you've the dot local that you've created. Now let's say you. So it's on your storage so it's persistent. Now you reboot the system and you don't download another, you pip install something else, and you move that new dot local that it's going to create isn't that going to overwrite what's in your storage. Yeah, so we haven't got to that bit yet so we're at this point we've got something that's working just for this instance but it's not going to work for a future one. So we need to, we need to what we're going to do. Mark is we're going to create a little Python script that that is before it starts the server before it starts Jupiter in the server, it's sim links it creates this sim link. In the future if I type pip install minus, minus user it'll store it in dot local slash blah, that's dot local will already be pointing at slash storage. So actually stick it in slash storage and that's that's the secret trick. I got it. Okay, thank you. And, Mark, I think you're the one who said on the forum about like, are we sure this is a good idea was that was that you and. Yeah, that's me I don't want to, I don't want to make it all about me but I've had so many. I want to make it about you because like you you're at my target demographic here is people who aren't particularly confident at the show. It's just, you're the one person who was brave enough to join in I think despite having less experience at the terminal so I actually want you to be particularly happy to interrupt anytime something's not clear. Yeah, no I started this course a few times and every time the problem is always the thing that always makes me stop is this stuff. I kept like getting conflicts and I remember there was an old version of I think it was paper space I can't remember that you were recommending and it kept crashing and it kept losing work and yeah so I guess I'm a little paranoid about creating things that are going to create. So to be clear, I don't feel like we've had a great solution for running fast AI cheaply and easily until now. So the reason you've had problems before is that like, there wasn't a great solution before. So this is the first time I'm actually saying to you I really do think this is going to work. And so anytime something goes wrong like feel free to like share your screen or anything because that debugging process will also be useful so I'd say for now. You know suspend disbelief give it a go and you know if it all falls apart blame me and I will happily fix it and so it goes for anybody. As long as you're roughly following along with these steps if you do something totally different. Maybe I won't be so patient. Okay, so, so look at what we did here we did two things we first of all moved out local to slash storage. And then we sim linked it back now we're not going to have to do that move ever again right with that that was just enough to kind of create a dot local slash storage slash config dot local to all we need to do. Next time we. Next time we create an instance is to create the same link. Like so. So, let's do it like for something so simple because I said I'm going to show you how I would do things for something so simple that I would actually create a bash script for this. And this is where things are going to get particularly interesting because Well, okay, I'm going to show you the proper way to do this and I'm also going to show you the slightly improper way to do this. I'm going to show you how to use them, which is actually a highly recommended editor that works in your terminal, but I'm also going to show you a trick for how you can use the Jupiter text editor. This is an in browser text editor, which currently we can't really use because it's, it's pointing at slash notebooks. So how would we change stuff, how would we edit stuff that's in slash storage. But what we could do is if we CD to slash notebooks. And then we create a sim link from storage. So just letting you know on my screen at least your cursor is just cut off from the bottom of the screen. So like I need to like make the browser a little bit smaller. Sounds like Jupiter is not quite showing this properly so you can see it now. Thank you. So if I sim link slash storage into slash notebooks. Then what should happen, there we go is it appears here, because this is showing me the contents of slash notebooks. So that would be one simple way to create a script here would be I could click plus and I could click text file. And we've got a text file. And so now we could copy and paste our sim link. So maybe copy, let's see, copy. Oh, that's annoying. That's very annoying. Copy stuff from the terminal. Oh, you're rotten scoundrel. I just did it with control C and control B. Yeah. Oh, it's because I'm on a Mac now I have to press command not control. Right, thank you. Okay. And you need to make sure you're in your home directory for this to work so CD. Okay. And to run this as a script you have to tell it it's a script. And the reason why it doesn't matter too much but the official, the kind of correct way to do that is to your first of all say hash bang that means the first line of the file in Linux and Mac tells it what program to run it with. And we want to run it with bash. And you're meant to do it like this for slightly obscure reasons. Slash user slash bin slash and bash that will run this script with bash. Okay, file save the slightly less correct way to do it is you could just say which bash to find out where bash is and it's actually slash bin slash bash. And, you know, you can also type that would also work. And that says when to Linux or Mac when you run this file, run it using this program, sorry, run it using this program. Okay, so file save. All right, so let's rename that and so in paper space. The special file called pre run.sh is run. When it starts a new instance. You might remember that, you know, in fact, let's let's it's good to before you just go ahead and start an instance let's try to like run it and see if it works if I type dot slash pre run. .sh and press enter. It doesn't work. And so the reason why it doesn't work hopefully you're starting to remember now is that we need. We need permissions to be set correctly. And in particular we're missing the x here, the execute permission. And so in the past lessons I've shown you you can type ch mod u plus x to add the execute permission to a file like so. But I also actually kind of lied I don't normally use that way of setting permissions normally I set all the permissions at once. I would actually normally type this I would 755 pre run.sh now let me explain why 755. And the reason I did it the other way before is it required less explanation. So 755 is not the number 755 it's actually three separate numbers the number seven the number five and the number five. It says these are permissions for the user. These are permissions for the group. These are permissions for everybody. And then the permissions. I'll just a moment. So, actually it's not quite 555 that I want, but that's okay. So basically for each one it's going to add up three numbers the one a two and a five a one if it's executable, a two if it's writable, and a four if it's readable. So, seven means readable and writable and executable for the user for means readable for the group and then this four means readable for everybody. So if I check this now, you can see it's got okay so this rwx is four plus two plus one equals seven dash dash that's four plus zero plus zero dash dash four plus zero plus zero so this these permissions are seven four four. So that's, yeah, slightly weird if you've done stuff with bit flags in your programming before it'll look pretty familiar and then if you haven't it might look weird. This kind of thing does come up quite a lot actually in programming as a pricing amount so it's probably worth getting familiar with the idea of bit flags. So that now should be able to be runnable. And it is now runnable and so it's good we ran it because it tells us that oh you can't create a symbolic link because it already exists. Now, I'm not sure before Jupiter starts if this directory will be here or not. So, it would probably be a good idea to assume it does. So, to avoid that, we could first of all go remove recursively and forcefully the any dot local directory or file that exists. And so, if I now save that and try to run it again. Okay, it's worked. So that's good. So we should now be able to create a new notebook and I will, I'm not really doing anything with the GPU at the moment so I'm not going to spend their money unnecessarily so let's just create any tiny little instance here space. Start. There we go. Okay so that's going to go ahead and start. That's done that bit from scratch. So let's now do our keys from scratch as well. So, and you know I would probably not do that SSH key gen thing in real life so let's let's do it all the way I would do it so I would just say make dot SSH that's where our keys are going to go. Okay. And then upload my keys. Oops. And so then that CD to dot SSH and move. I put them in storage so storage ID RSA star. Into here. Oops. Oh crap. I just messed that up. Now I'd have to upload them again. Sorry. Move them into here. So there they are. And in fact let's do LA because that tells us dot which is the permissions on this directory. Okay so the dot SSH directory nobody else should be able to access it. So if I go CH mod 700 7 0 0 that means four plus two plus one so all permissions for me the user and no permissions for anybody else on the directory. Okay. And then actually. The ID RSA it's just readable and writeable so 600 for my private key. And then for the public key it's readable and writeable by me but only readable by everybody else. So there we've got it. Okay so this is what 700 permissions look like. This is what 600 permissions look like and this is what 644 permissions look like. And after a while actually you start getting used to the idea of like oh 644. Anything that you can read and write and other people can read, you know, 700 any directory that you can fully access 600 anything that only you can read and write they kind of become like standard little concepts in your head. So at that point we should be able to test this now by SSH into the username get at github.com and I've successfully authenticated. Now if that doesn't work for you. It's almost always because of permissions but you can get a lot more information by running SSH verbose Lee by typing minus V and it's quite cute the more these you type the more verbose it is so very very very verbose. Okay, and it'll tell you all the stuff it's doing. And so now we've done that. Hopefully you won't be too surprised to hear that we want to do exactly the same thing with a dot SSH folder which is we want to move it into our persistent storage and then link it back again. So move dot SSH into storage config and then sim link it back again. Now, rather than manually doing that we could just go into our script and copy and paste these two lines. Okay, and do it for SSH folder as well. So save that. And so if I run that script now, you can see my SSH is now sim linked. And if I test it so I pressed control get gets me back the last thing I typed with get in it. Yep, it still works. Okay. And this notebook is hopefully finished starting yes it has. And I just got to use the paper space ID just because I'm testing and we can test. Yep, so this is a brand new instance I started in another tab and my dot local has successfully appeared there. So we can see that our pre launch thingy is working. Okay. I think that's everything that I wanted to show today does anybody have any questions before I go. Sorry about the slow start. Quick question. Jeremy. You've, you can see a file structure there on the left hand side. I see just nothing. Yeah, so this is my old. Yeah, so my persistence storage already had stuff in it. So I've just been deleting stuff. Okay, the reason we see storage is because of that sim link I created earlier. So if I type history part correct. When you start the instance is when you're on your left hand top, you will be looking at your notebooks directory. Exactly that is your notebooks directory. And so you might have missed it but earlier on what I did was I sim linked my storage directory into my notebooks directory so that I could edit. So if you missed that bit just watch the video and you'll see it happen. But yeah, it was this is this line here lm minus slash storage and I put it into notebooks. Otherwise it's going to have to show you how to use them but I might show you how to use them next time, but this way we can use our editor. Great. And the thing that makes it work across new servers is that the pre run file is in the storage. The pre run file is special. So you might have noticed that when you go to the advanced options when you start the instance it says what program should it run when it starts and it's default it runs a program called run SH. And if you look at that run SH. It says here run the pre run SH. So it has to be that exact place and that exact name it's a special file. This is a paper space specific thing. So as long as pre run is in storage with that exact format it will be across servers. Exactly right yeah it'll be across servers because it's in slash storage and it will be run because the run dot SH file runs it as you know. Yeah, exactly. So Jeremy just a quick question about pre run, did you created that right. The pre run SH file it was not there. Yeah, so in bash this if here actually says if minus F is this file exists, then run it. That's what that bash means and so paper space that you know I said to paper space could you please add that to our to our image so everybody who uses the fast AI image will will have this and so if you create a pre run SH in here, then it's going to run it. Right so we would be creating that it won't be pre correct the way I created it and again go back and watch the video if you if you miss this and you want to see it again. I double clicked on storage, and then I clicked on plus, and I clicked on text file. And that created a text file called on title dot text which I then right clicked on and I said rename and I renamed it to pre run on SH. There was one before, like I saw the dot back so I got the dot back one yeah don't worry but that's so that's the one I moved out of the way that's my actual one that I want. I saw that already and I was like okay did it the system created for you. Yeah, yeah, that was just trying to get mine out of the way so it didn't make me cheat. So then the last step of course we have to do is to stop our server. There'll be one quick question. How do we ensure that we are not disturbing system Python many times about when I'm installing in my system, I somehow I mess up things. Have you watched the previous three, three walkthroughs. Okay, so watch that where we basically answer that question I believe but if you have any if it doesn't answer your question then please ask next time. Thank you thank you. No worries. All right thanks all. Bye. Bye.