kwea123 / nerf_pl

NeRF (Neural Radiance Fields) and NeRF in the Wild using pytorch-lightning
https://www.youtube.com/playlist?list=PLDV2CyUo4q-K02pNEyDr7DYpTQuka3mbV
MIT License
2.74k stars 483 forks source link

Train Error `python train.py` requested GPUs: [0] #105

Closed asbeg closed 3 years ago

asbeg commented 3 years ago

Hello, I have followed your example to train NERF on my own data. So I have seen you and other guys have some success with single object scene? and get this error.

Im using MacOS based M1 Chip, does anyone have any idea what this might be related to. I can't figure out what's going on. Can you explain what the problem might be and how to fix it ? Thank you in advance for any help.

I am trying to run

python train.py \
   --dataset_name llff \
   --root_dir /Users/ab/ProjectTest/LLFF \
   --N_importance 64 --img_wh 504 378 \
   --num_epochs 30 --batch_size 1024 \
   --optimizer adam --lr 5e-4 \
   --lr_scheduler steplr --decay_step 10 20 --decay_gamma 0.5 \
   --exp_name exp
  File "train.py", line 178, in <module>
    profiler=hparams.num_gpus==1)
  File "/opt/anaconda3/envs/nerf_pl/lib/python3.6/site-packages/pytorch_lightning/trainer/trainer.py", line 438, in __init__
    self.data_parallel_device_ids = parse_gpu_ids(self.gpus)
  File "/opt/anaconda3/envs/nerf_pl/lib/python3.6/site-packages/pytorch_lightning/trainer/distrib_parts.py", line 712, in parse_gpu_ids
    gpus = sanitize_gpu_ids(gpus)
  File "/opt/anaconda3/envs/nerf_pl/lib/python3.6/site-packages/pytorch_lightning/trainer/distrib_parts.py", line 678, in sanitize_gpu_ids
    """)
pytorch_lightning.utilities.exceptions.MisconfigurationException: 
                You requested GPUs: [0]
                But your machine only has: [].
kwea123 commented 3 years ago

By default the code expects 1 gpu on which it trains (and evals), so it won't work if you don't have gpu. https://github.com/kwea123/nerf_pl/blob/19a290103fd8df211a85a150daff861b53d59942/train.py#L173 If you really want to train without gpu (not at all recommended), please look at the pytorch-lightning documentation of how to use cpu to train, it should be easy to just specify another argument.