Go back

Setup and installation of 'Comfy UI: Stable Diffusion AI Image Generation Made Simple' on GCP

This section describes how to launch and connect to ‘Comfy UI: Stable Diffusion AI Image Generation Made Simple’ in a Google Compute environment using the available Cloud Launcher offering.

  1. Open Comfy UI: Stable Diffusion AI Image Generation Made Simple listing on GCP Marketplace

  2. Click Launch.

/img/gcp/comfyui-vm/marketplace.png

  • It will take you to the agreement page. On this page, you can change the project from the project selector on top navigator bar as shown in the below screenshot.

  • Accept the Terms and agreements by ticking the checkbox and clicking on the AGREE button.

/img/common/gcp_agreement_page.png

  • It will show you the successfully agreed popup page. Click on Deploy.

/img/common/gcp_agreement_accept_page.png

  • On deployment page, give a name to your deployment.

  • In Deployment Service Account section, click on Existing radio button and Choose a service account from the Select a Service Account dropdown.

/img/common/service_account_setup_for_terraform/existing_account_2.png

  • If you don’t see any service account in dropdown, then change the radio button to New Account and create the new service account here.

/img/common/service_account_setup_for_terraform/create-new-service-account.png

  • If after selecting New Account option, you get below permission error message then please reach out to your GCP admin to create service account by following Step by step guide to create GCP Service Account , and then refresh this deployment page once the service account is created, it should be available in the dropdown.
You are missing resourcemanager.projects.setIamPolicy permission, which is needed to set the required roles on the created Service Account

/img/common/service_account_setup_for_terraform/iampolicy-permission-error.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 optimal performance, Stable Diffusion requires significant processing power, which is best achieved with a GPU instance. However, if the cost of a GPU instance is prohibitive, a CPU instance with higher processing capacity may be used as an alternative.

Below are the recommended VM configuration:

  • GPU VM : NVIDIA T4 with 1 GPU with n1-standard-4 (4 vcpu 15GB memory) configuration
  • CPU VM : n1-standard-4 (4vcpu, 15gb ram)

For CPU, its the minimum spec but more cpu is preferred.

/img/gcp/comfyui-vm/deployed-02-gpu.png

/img/gcp/comfyui-vm/deployed-02.png

NOTE: While deploying the instance on GPU, if you encounter the quota exhaust error or you are unable to deploy the instance on GPU VM then please refer to our Request Quota on Google Cloud Platform

  • Optionally change the boot disk type and size. (This defaults to ‘Standard Persistent Disk’ and 60 GB respectively)

  • Select the default Networking configuration. Default Networking configuration comes with the ports 22 (for ssh), 3389 (for RDP) and 443 (for HTTPS) exposed.

  • Click Deploy when you are done.

  • Comfy UI: Stable Diffusion AI Image Generation Made Simple will begin deploying.

/img/gcp/comfyui-vm/deployed-03.png

  1. A summary page displays when the compute engine is successfully deployed. Click on the Instance link. It will open an overview page of virtual machine. .

  2. To access the ComfyUI web interface, copy the public ip of the vm from VM’s details page and paste it in the browser using https://VM_Public_IP. Make sure to use https and not http.

/img/gcp/rancher/public-ip.png

Browser will display a SSL certificate warning message. Accept the certificate warning and Continue.

/img/azure/comfyui-vm/browser-warning.png

By default, the ComfyUI’s default workflow will be automatically loaded after the start, as shown in the figure below.

/img/azure/comfyui-vm/comfyui.png

If the interface is blank or the default workflow is not loaded, please click on the Load default / Load default in the right corner menu to load the default workflow.

/img/azure/comfyui-vm/load-default.png

  1. Now you are connected to Comfy UI. By default the VM comes with SDXL Base 1.0 checkpoint model to get you started with the comfy UI.

/img/azure/comfyui-vm/sdxl-checkpoint.png

  1. To get started, provide the prompt in the Clip Text Encode (prompt) box with any extra condition in the below prompt box. Give the size of the image and the batch count. Provide other settings in Sampler.

/img/azure/comfyui-vm/prompt-settings.png

  1. Once you are ready to create your image, simply press Queue Prompt from right settings pane and watch your image getting generated.

Note: GPU instances generate images 10 times faster or more compared to CPU instances. Therefore, if you’re using a CPU instance, expect the process to take 10-15 minutes longer to complete.

/img/azure/comfyui-vm/queue-prompt.png

  1. You can check the extra options from the options given below the Queue Prompt button. Like history, view queue etc.

/img/azure/comfyui-vm/extra-options.png

  1. The images created from ComfyUI are stored under /home/ubuntu/setup/ComfyUI/output/ directory on the VM. To access this directory, follow below steps:

/img/azure/comfyui-vm/comfyui-output-directory.png

  1. To access the VM’s Desktop environment, first you need to SSH to this instance. For that, On the instance page, click on the “SSH” button, select “Open in browser window”

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

  1. This will open SSH window in a browser.

  2. Run below command to set the password for “ubuntu” user

sudo passwd ubuntu

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

  1. 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.

  2. To connect using RDP via Windows machine, first note the external IP of the VM from VM details page

  3. In the “Remote Desktop connection” wizard, paste the external ip and click connect

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

  1. This will connect you to the VM’s desktop environment. Provide “ubuntu” as the userid and the password set in the above step to authenticate. Click OK

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

  1. Now you are connected to out of box ‘Comfy UI: Stable Diffusion AI Image Generation Made Simple’ VM’s desktop environment via Windows machines.

/img/azure/comfyui-vm/rdp-desktop.png

  1. 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, firstInstall Remmina as per your linux distribution.

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

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

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

  1. This will connect you to the VM’s desktop environment. Provide “ubuntu” as the userid and the password set in the above steps to authenticate. Click OK

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

  1. Now you are connected to out of box ‘Comfy UI: Stable Diffusion AI Image Generation Made Simple’ VM’s desktop environment via Linux machine.

/img/azure/comfyui-vm/rdp-desktop.png

  1. From VM’s Desktop, you can access the Output Images by navigating to /home/ubuntu/stable-diffusion/outputs/ directory

/img/azure/comfyui-vm/comfyui-output-directory.png

Please refer to How to download and use custom models page for more details on using additional models with this VM.

For more information, please visit ComfyUI Official Documentation

Go back