Link to files: https://drive.google.com/open?id=13Prpe ... T24F0ELaY0
To start off, create/login to a Google account, head to https://cloud.google.com/, hit 'Get started for free' and fill out the details. You'll need a credit card but won't be billed. Hurray, now you have $300 in free credit. Next, upgrade your account. You won't be billed, but only with an upgraded account can you apply to use GPUS. I'm using a P100 GPU, however you can of course use any GPU Google provides, steps will be the same.
Name your project as desired. Then, from the navigation menu, head to the quotas (IAM & admin -> Quotas). Under metrics, select NVIDIA P100 GPUs in case you want to use more than one GPU and select GPUS (all regions) Select the P100 quota for the region you want in case you want to use more than one GPU, select the all regions quota, hit edit quotas, fill in your details, your desired number of GPUS and a description. Just be honest, 'Machine learning work' will do. In my experience it takes 2 hrs for Google to approve quota requests, however it can take up to 48 hrs.
Once your request is approved it's time to create a VM. To do so, head to VM instances (Compute Engine -> VM instances). Create an instance with the following settings:
Region: In case you increased the P100 quota, make sure to match the region
Machine type: n1-standard-4 (4 vCPU, 15GB memory)
GPUs: NVIDIA Tesla P100 (select a different zone if not available)
Boot disk: GPU Optimized Debian m32 (with CUDA 10.0), disk type: SSD persistent disk, size: 50 GB
Access scopes: Allow full access to all Cloud APIs
Firewall: Tick both boxes (Allow HTTP traffic, allow HTTPS traffic)
Create the instance, once this is done it'll start automatically. Hit the SSH button, a terminal will open.
Once you're connected, you'll be prompted to install the Nvidia driver, do so by entering y. Next, upload the two files I have attached, fsr and xstartup. You can do so by clicking on the settings wheel in the top right and clicking upload file.
Execute the following command to make the script executable:
Code: Select all
chmod +x fsr
Then execute the main script:
Code: Select all
./fsr
During the execution of the script you'll be prompted a number of times.
Press ENTER to continue installing Miniconda.
Enter yes to accept the license terms.
Press ENTER to confirm the default Miniconda installation location.
Press ENTER to not initialize Miniconda.
Press ENTER to proceed with the virtual environment installation.
Press ENTER to not enable AMD support.
Press ENTER to not enable Docker.
Press ENTER to enable CUDA.
Enter y to continue.
Press ENTER to select the default keyboard layout.
Enter (and remember) a password for your VNC server twice. (8 char limit)
Enter n to not enter a view-only password.
Edit the permissions of the startup file by executing
Code: Select all
chmod +x ~/.vnc/xstartup
Launch the VNC server by executing
Code: Select all
vncserver -geometry 1920x1080
On your local machine, install the Google Cloud SDK by following the quickstart for your OS and install VNC Viewer.
Then, execute the following command in the terminal on your local machine
Code: Select all
gcloud compute ssh YOUR_INSTANCE_NAME --project YOUR_PROJECT --zone YOUR_ZONE --ssh-flag "-L 5901:localhost:5901"
where you replace YOUR_INSTANCE_NAME, YOUR_PROJECT and YOUR_ZONE accordingly. If done correctly you should see your instance name appear in the terminal (user@YOUR_INSTANCE_NAME).
In VNC Viewer enter
Code: Select all
localhost::5901
as address and enter the aforementioned password. Boom, you're in.
To launch the faceswap GUI, launch the terminal (Applications -> System Tools -> Terminal) and execute the following commands (from your home directory):
Code: Select all
cd faceswap
conda activate fs
python faceswap.py gui
Some additional notes:
You can copy/paste freely from your local machine to the VM and back.
To launch/kill the vncserver on the VM, execute
Code: Select all
vncserver -geometry 1920x1080
or
Code: Select all
vncserver -kill :1
respectively.
In case you want to exit the virtual environment, execute
Code: Select all
conda deactivate
Remember to stop your instance when you are done. Set up alerts if necessary so you don't go over the $300 free credit.