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

Invalid CUDA 'device=0,1,2,3,4,5,6,7' requested. Use 'device=cpu' or pass valid CUDA device(s) if available, i.e. 'device=0' or 'device=0,1,2,3' for Multi-GPU. #31

Open
dyzlumos opened this issue Jul 17, 2024 · 1 comment

Comments

@dyzlumos
Copy link

dyzlumos commented Jul 17, 2024

based projA module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.0 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last): File "/data/dyz/Mamba-YOLO-main/mbyolo_train.py", line 1, in
from ultralytics import YOLO
File "/data/dyz/Mamba-YOLO-main/ultralytics/init.py", line 10, in
from ultralytics.data.explorer.explorer import Explorer
File "/data/dyz/Mamba-YOLO-main/ultralytics/data/init.py", line 3, in
from .base import BaseDataset
File "/data/dyz/Mamba-YOLO-main/ultralytics/data/base.py", line 15, in
from torch.utils.data import Dataset
File "/home/anaconda3/envs/mambayoloD/lib/python3.11/site-packages/torch/init.py", line 1382, in
from .functional import * # noqa: F403
File "/home/anaconda3/envs/mambayoloD/lib/python3.11/site-packages/torch/functional.py", line 7, in
import torch.nn.functional as F
File "/home/anaconda3/envs/mambayoloD/lib/python3.11/site-packages/torch/nn/init.py", line 1, in
from .modules import * # noqa: F403
File "/home/anaconda3/envs/mambayoloD/lib/python3.11/site-packages/torch/nn/modules/init.py", line 35, in
from .transformer import TransformerEncoder, TransformerDecoder,
File "/home/anaconda3/envs/mambayoloD/lib/python3.11/site-packages/torch/nn/modules/transformer.py", line 20, in
device: torch.device = torch.device(torch._C._get_default_device()), # torch.device('cpu'),
/home/anaconda3/envs/mambayoloD/lib/python3.11/site-packages/torch/nn/modules/transformer.py:20: UserWarning: Failed to initialize NumPy: _ARRAY_API not found (Triggered internally at ../torch/csrc/utils/tensor_numpy.cpp:84.)
device: torch.device = torch.device(torch._C._get_default_device()), # torch.device('cpu'),
WARNING ⚠️ no model scale passed. Assuming scale='L'.
Ultralytics YOLOv8.2.29 🚀 Python-3.11.9 torch-2.1.0+cu121
Traceback (most recent call last):
File "/data/dyz/Mamba-YOLO-main/mbyolo_train.py", line 44, in
"train": YOLO(model_conf).train(**args),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/dyz/Mamba-YOLO-main/ultralytics/engine/model.py", line 655, in train
self.trainer = (trainer or self._smart_load("trainer"))(overrides=args, _callbacks=self.callbacks)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/dyz/Mamba-YOLO-main/ultralytics/engine/trainer.py", line 101, in init
self.device = select_device(self.args.device, self.args.batch)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/dyz/Mamba-YOLO-main/ultralytics/utils/torch_utils.py", line 136, in select_device
raise ValueError(
ValueError: Invalid CUDA 'device=0,1,2,3,4,5,6,7' requested. Use 'device=cpu' or pass valid CUDA device(s) if available, i.e. 'device=0' or 'device=0,1,2,3' for Multi-GPU.

torch.cuda.is_available(): True
torch.cuda.device_count(): 4
os.environ['CUDA_VISIBLE_DEVICES']: None
ects

@dyzlumos dyzlumos changed the title Pip install. Error, can you help me solve it? Invalid CUDA 'device=0,1,2,3,4,5,6,7' requested. Use 'device=cpu' or pass valid CUDA device(s) if available, i.e. 'device=0' or 'device=0,1,2,3' for Multi-GPU. Jul 19, 2024
@EthanW-coder
Copy link
Collaborator

If you only have one GPU, set device to '0'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants