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

how to use CPU for testing purposes. #39

Open
brian-arnold opened this issue Nov 8, 2023 · 3 comments
Open

how to use CPU for testing purposes. #39

brian-arnold opened this issue Nov 8, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@brian-arnold
Copy link

Hello! Thank you for this incredibly well-documented tool!

I'm trying to get familiar with your software using my own personal computer that doesn't have a GPU (or rather has a MAC GPU which I know can be specified with device = torch.device("mps")), and I keep getting the following exception:

MisconfigurationException: Trainer(devices=0) value is not a valid input using cpu accelerator.

I received this message for the basic usage tutorial and also trying the DeepSTARR model. How would I use your API to allow the model to use CPU for testing purposes?

Thank you!
Brian

@brian-arnold brian-arnold changed the title how to use CPU for testing purpooses. how to use CPU for testing purposes. Nov 8, 2023
@adamklie adamklie self-assigned this Nov 8, 2023
@adamklie adamklie added the bug Something isn't working label Nov 8, 2023
@adamklie
Copy link
Collaborator

adamklie commented Nov 8, 2023

Hey Brian!

Thanks so much for raising this issue. This has to do with the fact that PyTorch Lightning changed the trainer API in their 2.0.0 release. I'll have a permanent fix for this shortly, but for now you should be able to train on a CPU by running settings.gpus = "auto" right before training. You can also pass in gpus = "auto" to the train.fit_sequence_module function.

For running on your MAC GPU, can you send me the output of running the following via the command line:

 python -m torch.utils.collect_env

@brian-arnold
Copy link
Author

Amazing! Thanks!

And as for using MAC GPU, I was able to get torch to use it for some other software using device = torch.device("mps"), but as for the output of python -m torch.utils.collect_env:

(eugene) bjarnold@PU-D732CVM0JX eugene % python -m torch.utils.collect_env
Collecting environment information...
PyTorch version: 2.1.0
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: macOS 14.1 (x86_64)
GCC version: Could not collect
Clang version: 15.0.0 (clang-1500.0.40.1)
CMake version: Could not collect
Libc version: N/A

Python version: 3.9.18 | packaged by conda-forge | (main, Aug 30 2023, 03:52:10)  [Clang 15.0.7 ] (64-bit runtime)
Python platform: macOS-14.1-x86_64-i386-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Apple M2 Max

Versions of relevant libraries:
[pip3] mypy-extensions==1.0.0
[pip3] numpy==1.23.5
[pip3] pytorch-lightning==2.1.0
[pip3] torch==2.1.0
[pip3] torchinfo==1.8.0
[pip3] torchmetrics==1.2.0
[conda] numpy                     1.23.5                   pypi_0    pypi
[conda] pytorch-lightning         2.1.0                    pypi_0    pypi
[conda] torch                     2.1.0                    pypi_0    pypi
[conda] torchinfo                 1.8.0                    pypi_0    pypi
[conda] torchmetrics              1.2.0                    pypi_0    pypi

@adamklie
Copy link
Collaborator

adamklie commented Nov 9, 2023

Ok gotchya, yea EUGENe isn't very sophisticated with it's detection of devices. If the output of torch.cuda.is_available() is False, it will assume no GPU is available.

From a quick look, it seems like PyTorch Lightning needs to be told the accelerator is "mps". So right now, I'm not sure you could run the train or eval module methods with it, but I'll add support for this. Happy to give you a workaround if you need to use MPS for the time being.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants