So, welcome to my channel. In this video, I will show you how you can run Stable Diffusion on SageMaker Studio Lab. Make sure your GPU runtime is selected. We will start by clicking on "Open Project". Then, you need to download this zip file. ou will find the link to it in the pinned comment of the video. After downloading, you need to extract it. Extract the contents of the file. Once extracted, you will get various contents inside.. You can either drag and drop them or upload them. I will drag and drop them. I will drag and drop them. Next, you need to open a terminal. First, run conda update sh_updateconda.sh. you have to do that only once This will take some time. I have fast-forwarded the video, so mine will be done a bit quicker. Once that is done, you need to restart the runtime. Close SageMaker Studio and then start it again So, let's stop and start the runtime. Then, start the runtime. Make sure you have selected the GPU. The runtime has started, then open it. ...project. After that, you need to click on this. Then you need to run this first cell. This will take some time as well. I have fast-forwarded the video by 8x, so mine will finish quickly. I have fast-forwarded the video by 8x, so mine will finish quickly. You need to wait here until it shows "Done." Once it shows "Done," then run the second cell. Now we have provide our token for NGROK. So, go to the NGROK website, log in, and copy your token to paste it here. I will also use zrok for this and remove the ngrok . It will now ask you to select 1 for CPU or 2 for GPU. If you want to use the GPU, select 2; if using the CPU, select 1. Now it is installing the requirements. This will take some time. So, now we need to restart it. Restart it from here. I have restarted it. Now again, we will start the second cell. Whenever you run SageMaker, you only need to run the second cell. The first cell needs to be run only once. Then you need to provide the token again. My runtime is GPU, so I will select 2. You will need to wait for a while here. This takes some time. [Music] You can ignore this as it is showing a warning due to the torch version being incompatible. Our web UI is running. Now we will click on this link and visit the site. You can see that our Stable Diffusion web UI has opened. You can see here that only one checkpoint is installed. You can install more checkpoints if you want. Let me show you how to install checkpoints. Come here, open a new terminal. Then you need to run 'sh_installcheckpoint'.sh This will install checkpoints. When you run it, it will ask for the checkpoint link. I have a link for the Lastik Vision v5, which is the base model for Stable Diffusion. I will give it this link. It will download it from Hugging Face. You can also provide the link from civit ai. So, it is done now. We need to give it a file name. You can give it any name. I will name it 'Lastik Vision v5.' I have given it the name. Now hit Enter. Our checkpoint is installed. You can go to the web UI, refresh it, and see our checkpoint is here. Now I will use it to generate an image. I will show you by generating an image of a rose. You can see our image is being generated. You can see our image is almost generated. If you want to install a LoRA (Low-Rank Adaptation) model, you need to follow the same steps. Let me show you how to install a LoRA model. Run 'install_lora'. It will ask for the link. Go civit ai and select your LoRA model. I will select this LoRA model, but you can select any. So, copy the link address and paste it in SageMaker.
Go to the LoRA section and see our ice model is there. You can use it now. Then it will download the model. Now it will ask for the name. I will name it 'ice' since this is the ice model. Our download is complete. Go to the LoRA section, refresh it once, and you can see the model. If it doesn't show after refreshing, go to settings, then Extra Networks. If it doesn't show up, go to settings, Extra Networks, check "Always show networks on LoRA page," and apply the settings. Click Apply Settings. Restart the web UI.click here for stop and run second cell you have to follow the same steps i mean you have to run only second cell to run stable diffushion First cell and conda install are only needed once. Click Visit Site. You can see our web UI is open. Go to the LoRA section, and you can see our ice model is there. You can use it now. Let me show you again how to restart it. Go to JupyterLab and open it. Run the second cell. Give the token. Select GPU or CPU runtime. GPU gives better results than CPU. You need to wait 30 to 40 seconds. If it asks to restart, do it once. Give the token and select the runtime again. Our web UI will restart. It is not publicly accessible because it is running locally. You can see it is running locally. Click NGROK public URL, then visit. Our web UI is open. The model and checkpoints are already installed. If you want to check storage, you can do it here. Run it and it will show available storage. You can delete anything if needed. Please like, subscribe, and share.