Training and tips
Tips
When you are working inside your VM, treat it as your own machine. You can clone GitHub repositories, create folders, download files, and more.
- If you are working on a project, it is highly recommended to create a GitHub repository and upload your files there, allowing you to clone the repository directly into your VM.
- If you have a large dataset that needs to be available on your VM, you can download it directly to your local VM running Ubuntu. Simply open the browser, navigate to your dataset, and download it. Then, use the following command to copy it from your local VM to the remote VM you are accessing:
scp -P 10906 ~/Downloads/dataset user@38.29.145.12:/home/user/folder
In this command, 10906 is the SSH port, and user@ip_address represents the user and IP address of the remote VM. The first path is the source directory on your local machine, and the second path (after the IP address) is the destination directory on the remote VM.
- If you need to install libraries before starting your work, it’s best to create a virtual environment after installing Python. You can do this using the following commands:
- Install Python virtual environment support: sudo apt install python3-venv
- Create a virtual environment: python3 -m venv myenv
- Activate the virtual environment: source myenv/bin/activate
- Install packages within your virtual environment: pip install package_name
Train the model
Once you have installed all necessary libraries and completed your setup, you can begin training your model. The training process is typically done through the terminal of your VM. Make sure to prepare the training command and execute it.
Example:
!python train.py --name people \
--lr 4e-5 \
--batchSize 4 \
--gpu_ids 0 \
--dataset "/home/user/folder/dataset" \
--total_step 250000 \
--Gdeep False \
--continue_train True \
--model_freq 1000 \
--load_pretrain "/home/user/folder/checkpoints/people" \
--checkpoints_dir "/home/user/folder/checkpoints" \
--which_epoch 150000
The above script is an example of a training command. Be sure to save checkpoints to a specified directory, as you will need to access this directory later and copy the latest model to your local machine for future use.
How to Train?
You can run the training process directly from the terminal, or you can create a Python script, write your code in it, and then execute the script.
nano myscript.py #to create a python script and you can start writing.
Once you have finished, press Ctrl + O to save, and Ctrl + X to exit. Then, run the script by entering the following command in the terminal: python myscript.py