qq456cvb / Point-Transformers

Point Transformers
MIT License
638 stars 102 forks source link

Resolved- Prepare Environment + omegaconf: Missing key pretty + No CUDA GPUs are available #47

Open MinhasKamal opened 3 months ago

MinhasKamal commented 3 months ago

Hardware Requirements with GPU

OS: Linux (Instead of installing the latest version try with a slightly older one. Because, the latest version might not have support for CUDA. I worked with- Ubuntu 22.04)

GPU: 7GB+ for training classification model, 13GB+ for training segmentation model

Prepare Environment

Pre-requisites: Conda, CUDA

Run following commands:

// download the repo from github
wget https://github.com/qq456cvb/Point-Transformers/archive/refs/heads/master.zip
unzip master.zip
rm master.zip
cd Point-Transformers-master

// download the classification dataset
wget https://shapenet.cs.stanford.edu/media/modelnet40_normal_resampled.zip --no-check-certificate
unzip modelnet40_normal_resampled.zip
rm modelnet40_normal_resampled.zip

// download the segmentation dataset
mkdir data
cd data
wget https://shapenet.cs.stanford.edu/media/shapenetcore_partanno_segmentation_benchmark_v0_normal.zip --no-check-certificate
unzip shapenetcore_partanno_segmentation_benchmark_v0_normal.zip
rm shapenetcore_partanno_segmentation_benchmark_v0_normal.zip

// create new environment in conda 
conda create --name pt 
conda activate pt

// install dependency packages
conda install hydra-core
conda install tqdm
// get version info ‘nvcc --version’, ‘hostnamectl’, ‘nvidia-smi’ and generate installation command on- https://pytorch.org/ and run. The command might look like- conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia

omegaconf.errors.ConfigAttributeError: Missing key pretty:

Inside the main() function of train_cls.py (line- 52), edit print(args.pretty()) to print(omegaconf.OmegaConf.to_yaml(args)).

pretty() is no longer supported in the newer version of omegaconf. That is why, we use to_yaml().

RuntimeError: No CUDA GPUs are available

Inside config/cls.yaml, edit gpu: 1 to gpu: 0.

Or, Inside the main() function of both train_cls.py (line- 49) and train_partseg.py (line- 50), comment out the line- os.environ["CUDA_VISIBLE_DEVICES"] = str(args.gpu).

This issue might happen because you do not have a second GPU (you might ask ChatGPT for details). If your system has one GPU, then you do not need this line of code anyways.

AttributeError: module 'numpy' has no attribute 'float'

Inside train_partseg.py (line- 203), change dtype=np.float to dtype=float.

np.float is removed by the latest version of numpy.

Run code

python train_cls.py
// watch GPU usage with- watch -n 1 nvidia-smi

If you are using Putty to remotely train the models, then you can use Screen to run commands in the background.

MinhasKamal commented 3 months ago

@qq456cvb If you see it fit, I can send you a pull requests with an updated code and instructions for setup.