Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pytorch_lightning.utilities.exceptions.MisconfigurationException GPU not finding #1

Closed
arita37 opened this issue Feb 4, 2021 · 11 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@arita37
Copy link

arita37 commented Feb 4, 2021

Excellent work,

You can check , we are using it
https://github.com/arita37/dsa2/tree/multi

Set to CPU usage for lightning

  File "D:\_devs\Python01\ana3\envs\py36\lib\site-packages\pytorch_tabular\tabular_model.py", line 444, in fit
    reset,
  File "D:\_devs\Python01\ana3\envs\py36\lib\site-packages\pytorch_tabular\tabular_model.py", line 385, in _pre_fit
    self._prepare_trainer(max_epochs, min_epochs)
  File "D:\_devs\Python01\ana3\envs\py36\lib\site-packages\pytorch_tabular\tabular_model.py", line 328, in _prepare_trainer
    **trainer_args_config,
  File "D:\_devs\Python01\ana3\envs\py36\lib\site-packages\pytorch_lightning\trainer\connectors\env_vars_connector.py", line 41, in overwrite_by_env_vars
    return fn(self, **kwargs)
  File "D:\_devs\Python01\ana3\envs\py36\lib\site-packages\pytorch_lightning\trainer\trainer.py", line 345, in __init__
    deterministic,
  File "D:\_devs\Python01\ana3\envs\py36\lib\site-packages\pytorch_lightning\accelerators\accelerator_connector.py", line 111, in on_trainer_init
    self.trainer.data_parallel_device_ids = device_parser.parse_gpu_ids(self.trainer.gpus)
  File "D:\_devs\Python01\ana3\envs\py36\lib\site-packages\pytorch_lightning\utilities\device_parser.py", line 76, in parse_gpu_ids
    gpus = _sanitize_gpu_ids(gpus)
  File "D:\_devs\Python01\ana3\envs\py36\lib\site-packages\pytorch_lightning\utilities\device_parser.py", line 137, in _sanitize_gpu_ids
    """)
pytorch_lightning.utilities.exceptions.MisconfigurationException:
                You requested GPUs: [0]
                But your machine only has: []
device = 'cpu'
use_cuda = True
if use_cuda and torch.cuda.is_available():
    print('cuda ready...')
    device = 'cuda:0'
@manujosephv manujosephv self-assigned this Feb 4, 2021
@manujosephv
Copy link
Owner

@arita37 Which version of PyTorch Lightning are you using?

@arita37
Copy link
Author

arita37 commented Feb 4, 2021

I dont have a GPU on my laptop,
want to use CPU only




Requirement already satisfied: pytorch-lightning==1.0.8 in d:\_devs\python01\ana3\envs\py36\lib\site-packages (1.0.8)
Requirement already satisfied: PyYAML>=5.1 in d:\_devs\python01\ana3\envs\py36\lib\site-packages (from pytorch-lightning==1.0.8) (5.3)
Requirement already satisfied: fsspec>=0.8.0 in d:\_devs\python01\ana3\envs\py36\lib\site-packages (from pytorch-lightning==1.0.8) (0.8.5)
Requirement already satisfied: torch>=1.3 in d:\_devs\python01\ana3\envs\py36\lib\site-packages (from pytorch-lightning==1.0.8) (1.6.0+cpu)
Requirement already satisfied: numpy>=1.16.4 in d:\_devs\python01\ana3\envs\py36\lib\site-packages (from pytorch-lightning==1.0.8) (1.18.1)
Requirement already satisfied: tensorboard>=2.2.0 in d:\_devs\python01\ana3\envs\py36\lib\site-packages (from pytorch-lightning==1.0.8) (2.2.2)
Requirement already satisfied: tqdm>=4.41.0 in d:\_devs\python01\ana3\envs\py36\lib\site-packages (from pytorch-lightning==1.0.8) (4.42.0)
Requirement already satisfied: future>=0.17.1 in d:\_devs\python01\ana3\envs\py36\lib\site-packages (from pytorch-lightning==1.0.8) (0.18.2)
Requirement already satisfied: setuptools>=41.0.0 in d:\_devs\python01\ana3\envs\py36\lib\site-packages (from tensorboard>=2.2.0->pytorch-lightning==1.0.8) (49.6.0.post20201009)
Requirement already satisfied: werkzeug>=0.11.15 in d:\_devs\python01\ana3\envs\py36\lib\site-packages (from tensorboard>=2.2.0->pytorch-lightning==1.0.8) (1.0.0)
Requirement already satisfied: wheel>=0.26; python_version >= "3" in d:\_devs\python01\ana3\envs\py36\lib\site-packages (from tensorboard>=2.2.0->pytorch-lightning==1.0.8) (0.35.1)
Requirement already satisfied: six>=1.10.0 in d:\_devs\python01\ana3\envs\py36\lib\site-packages (from tensorboard>=2.2.0->pytorch-lightning==1.0.8) (1.14.0)
Requirement already satisfied: markdown>=2.6.8 in d:\_devs\python01\ana3\envs\py36\lib\site-packages (from tensorboard>=2.2.0->pytorch-lightning==1.0.8) (3.2.1)
Requirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 in d:\_devs\python01\ana3\envs\py36\lib\site-packages (from tensorboard>=2.2.0->pytorch-lightning==1.0.8) (0.4.2)
Requirement already satisfied: tensorboard-plugin-wit>=1.6.0 in d:\_devs\python01\ana3\envs\py36\lib\site-packages (from tensorboard>=2.2.0->pytorch-lightning==1.0.8) (1.8.0)
Requirement already satisfied: grpcio>=1.24.3 in d:\_devs\python01\ana3\envs\py36\lib\site-packages (from tensorboard>=2.2.0->pytorch-lightning==1.0.8) (1.27.2)
Requirement already satisfied: google-auth<2,>=1.6.3 in d:\_devs\python01\ana3\envs\py36\lib\site-packages (from tensorboard>=2.2.0->pytorch-lightning==1.0.8) (1.24.0)
Requirement already satisfied: absl-py>=0.4 in d:\_devs\python01\ana3\envs\py36\lib\site-packages (from tensorboard>=2.2.0->pytorch-lightning==1.0.8) (0.9.0)
Requirement already satisfied: requests<3,>=2.21.0 in d:\_devs\python01\ana3\envs\py36\lib\site-packages (from tensorboard>=2.2.0->pytorch-lightning==1.0.8) (2.22.0)
Requirement already satisfied: protobuf>=3.6.0 in d:\_devs\python01\ana3\envs\py36\lib\site-packages (from tensorboard>=2.2.0->pytorch-lightning==1.0.8) (3.11.3)
Requirement already satisfied: requests-oauthlib>=0.7.0 in d:\_devs\python01\ana3\envs\py36\lib\site-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard>=2.2.0->pytorch-lightning==1.0.8) (1.3.0)
Requirement already satisfied: cachetools<5.0,>=2.0.0 in d:\_devs\python01\ana3\envs\py36\lib\site-packages (from google-auth<2,>=1.6.3->tensorboard>=2.2.0->pytorch-lightning==1.0.8) (4.2.0)
Requirement already satisfied: rsa<5,>=3.1.4; python_version >= "3.6" in d:\_devs\python01\ana3\envs\py36\lib\site-packages (from google-auth<2,>=1.6.3->tensorboard>=2.2.0->pytorch-lightning==1.0.8) (4.7)
Requirement already satisfied: pyasn1-modules>=0.2.1 in d:\_devs\python01\ana3\envs\py36\lib\site-packages (from google-auth<2,>=1.6.3->tensorboard>=2.2.0->pytorch-lightning==1.0.8) (0.2.8)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in d:\_devs\python01\ana3\envs\py36\lib\site-packages (from requests<3,>=2.21.0->tensorboard>=2.2.0->pytorch-lightning==1.0.8) (1.22)
Requirement already satisfied: idna<2.9,>=2.5 in d:\_devs\python01\ana3\envs\py36\lib\site-packages (from requests<3,>=2.21.0->tensorboard>=2.2.0->pytorch-lightning==1.0.8) (2.6)
Requirement already satisfied: certifi>=2017.4.17 in d:\_devs\python01\ana3\envs\py36\lib\site-packages (from requests<3,>=2.21.0->tensorboard>=2.2.0->pytorch-lightning==1.0.8) (2020.11.8)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in d:\_devs\python01\ana3\envs\py36\lib\site-packages (from requests<3,>=2.21.0->tensorboard>=2.2.0->pytorch-lightning==1.0.8) (3.0.4)
Requirement already satisfied: oauthlib>=3.0.0 in d:\_devs\python01\ana3\envs\py36\lib\site-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard>=2.2.0->pytorch-lightning==1.0.8) (3.1.0)
Requirement already satisfied: pyasn1>=0.1.3 in d:\_devs\python01\ana3\envs\py36\lib\site-packages (from rsa<5,>=3.1.4; python_version >= "3.6"->google-auth<2,>=1.6.3->tensorboard>=2.2.0->pytorch-lightning==1.0.8) (0.4.8)


@manujosephv
Copy link
Owner

Can you send me the output from pip freeze ? because in my machine, when I use gpus=0, it runs without using gpu

@arita37
Copy link
Author

arita37 commented Feb 4, 2021 via email

@manujosephv
Copy link
Owner

TrainerConfig has gpus and is set to 0 by default

You can find the Documentation here

Are you working in Linux or Windows?

In the backend, this parameter is getting passed through to the PyTorch Lightning Trainer. You can see here that passing 0 to gpus means "run on cpu". Another alternative is to pass None to gpus. Can you check if that solves your problem?

@arita37
Copy link
Author

arita37 commented Feb 4, 2021 via email

@manujosephv
Copy link
Owner

Can you point me to the stackoverflow page?

And in the code we are passing gpus=0 and not gpus=[0]. Should we we passing [0] instead?

@arita37
Copy link
Author

arita37 commented Feb 5, 2021

@manujosephv
Copy link
Owner

Thanks a lot. Have made the default as None and pushed the updated to the repo. Haven't published it on PyPi yet. Have a couple more things to push before bumping the version.

Can you check out the latest code and check if the issue is resolved?

@arita37
Copy link
Author

arita37 commented Feb 6, 2021

thanks.
Thx for good work.
If you can test in CI in github action, that's useful.
you can check here my CI :
https://github.com/arita37/dsa2/blob/main/.github/workflows/test_fast.yml

Am developing dsa2, which has similar design pattern than this repo, (larget scope).
https://github.com/arita37/dsa2/issues/121

We can discuss

@manujosephv
Copy link
Owner

Pushed a new version fixing this. closing the issue

@manujosephv manujosephv added the good first issue Good for newcomers label Mar 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants