PRODUCTS AND SUPPORT


How to get Techlatest Stable Diffusion on GCP(Google Cloud Platform)




This section describes how to launch and connect to Techlatest Stable Diffusion in a Google Compute environment using the available Cloud Launcher offering.

Note: Stable diffusion requires a lot of processing, so a GPU instance is recommended. If a user wants to use a CPU instance due to the high price of GPU instances, they should use instances with a higher CPU.
GPU's are not available in some zones and for some instance types.

Below are recommended VM configuration requirements:

  • GPU VM : NVIDIA T4 with 1 GPU with n1-standard-4 (4 vcpu 15GB memory) configuration
  • CPU VM : e2-standard-4 (4vcpu, 16gb ram)
  • For CPU, its the minimum spec but more cpu is preferred.


    /img/gcp/stable-diffusion/gpu-instance.png

    /img/gcp/stable-diffusion/cpu-instance.png

Note: GPU instance will perform 10 times or more faster when processing request compared to CPU instance . Typical GPU instance will take 1-2 minutes to render images compared to 10-20 minutes by CPU instance, hence GPU instances are preferred.

  1. Open Techlatest Stable Diffusion listing on GCP Marketplace
  2. Click Launch.
  3. /img/gcp/stable-diffusion/marketplace.png


    • Select a zone where you want to launch the VM(such as us-east1-)
    • Optionally change the number of cores and amount of memory. ( This defaults to 4 vCPUs and 15 GB ram. For better performance please add GPU from the GPU section as shown in the below screenshot.)
    • Optionally change the boot disk type and size. (This defaults to 'Standard Persistent Disk' and 40 GB respectively)
    • Optionally change the network name and subnetwork names. Be sure that whichever network you specify has ports 22 (for ssh), 3389 (for RDP) and 80 (for HTTP) exposed.
    • Click Deploy when you are done.

      Techlatest Stable Diffusion will begin deploying.

    /img/gcp/stable-diffusion/deployed.png


  4. A summary page displays when the compute engine is successfully deployed. Click on the Instance link to go to the instance page .

  5. On the instance page, click on the "SSH" button, select "Open in browser window".

  6. /img/gcp/puppet-support/ssh-option.png


  7. This will open SSH window in a browser.
  8. Run below command to set the password for "ubuntu" user
  9. sudo passwd ubuntu

    /img/gcp/jupyter-python-notebook/ssh-passwd.png

  10. Now the password for ubuntu user is set, you can connect to the VM's desktop environment from any local windows machine using RDP or linux machine using Remmina.

  11. To connect using RDP via Windows machine, first note the external IP of the VM from VM details page as highlighted below

  12. /img/gcp/jupyter-python-notebook/external-ip.png

  13. Then From your local windows machine, goto "start" menu , in the search box type and select "Remote desktop connection"

  14. In the "Remote Desktop connection" wizard, paste the external ip and click connect

  15. /img/gcp/jupyter-python-notebook/rdp.png

  16. This will connect you to the VM's desktop environment. Provide "ubuntu" as the userid and the password set in step 6 to authenticate. Click OK

  17. /img/gcp/puppet-support/rdp-login.png

  18. Now you are connected to out of box Techlatest Stable Diffusion environment via Windows machines.

  19. /img/gcp/puppet-support/rdp-desktop.png

  20. To connect using RDP via Linux machine, first note the external IP of the VM from VM details page,then from your local Linux machine, goto menu , in the search box type and select "Remmina".

    Note: If you don't have Remmina installed on your Linux machine, first Install Remmina as per your linux distribution.


  21. /img/gcp/common/remmina-search.png

  22. In the "Remmina Remote Desktop Client" wizard, select the RDP option from dropdown and paste the external ip and click enter.

  23. /img/gcp/common/remmina-external-ip.png

  24. This will connect you to the VM's desktop environment. Provide "ubuntu" as the userid and the password set in step 6 to authenticate. Click OK

  25. /img/gcp/common/remmina-rdp-login.png

  26. Now you are connected to out of box Techlatest Stable Diffusion environment via Linux machine.

  27. /img/gcp/puppet-support/rdp-desktop.png

  1. To access the Stable Diffusion GUI via browser, Copy the public IP of the vm in the browser and hit enter.
  2. Note: Please use http and not https in the URL.
    Please Note that for the first time, it will take 2-3 minutes to launch the app in the browser. So if GUI is not coming please try after few minutes.
    Note: CPU instances take time to launch the Web UI. To verify if Stable Diffusion Web UI is launched, Please run below command in the terminal.

    curl http://127.0.0.1:7860

    If the output returns curl: (7) Failed to connect to 127.0.0.1 port 7860: Connection refused as shown below , then keep running above curl command till html output is found.

    /img/aws/stable-diffusion/failed-curl-output.png

    If this command returns html data as shown below, then Web UI is up and running. You can access it in browser using http://public_ip_of_vm

    /img/aws/stable-diffusion/success-curl-output.png

    /img/azure/stable-diffusion/stable-diffusion-gui-homepage.png

  3. The Stable Diffusion GUI comes with lots of options and settings. The first window shows text to image page. Provide the Prompt and click on Generate button and wait till it finishes.

  4. /img/azure/stable-diffusion/stable-diffusion-gui.png

  5. Output Images can be seen in the Image Browser tab. Click on Image browser and click on first page to load the images.

  6. /img/azure/stable-diffusion/image-browser-gallery.png

  7. In Image Browser, click on any image to see the details of it.

  8. /img/azure/stable-diffusion/image-browser.png

  9. To change any settings, go to Settings tab.

  10. /img/azure/stable-diffusion/settings.png

  11. Web UI also provides you the option to add extensions. Navigate to extensions tab, go to available and select load from URL. It will list all the available extensions.

  12. /img/azure/stable-diffusion/extensions.png

  13. For more information on how to use the GUI, Go to Stable Diffusion Web UI
  14. The images created from GUI are stored under /home/ubuntu/stable-diffusion/output directory.
    To access this directory, connect to VM's Desktop environment as explained above, and navigate to home -> ubuntu -> stable-diffusion -> output directory.

  15. /img/gcp/stable-diffusion/output-directory.png

  16. You can also access the sourcecode of the Stable Diffusion. It is available under sourcecode folder on Desktop.

  17. /img/gcp/stable-diffusion/source-code-folder-on-desktop.png

    /img/gcp/stable-diffusion/source-code.png

    Credits: