SpecialistOff.NET / Вопросы / Статьи / Фрагменты кода / Резюме / Метки / Помощь / Файлы

Список вопросов Печать

RuntimeError: No CUDA GPUs are available


Метки: python python ml 

... ).cuda()
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ in <module>:6                                                                                    │
│                                                                                                  │
│ /usr/local/lib64/python3.11/site-packages/torch/nn/modules/module.py:905 in cuda                 │
│                                                                                                  │
│    902 │   │   Returns:                                                                          │
│    903 │   │   │   Module: self                                                                  │
│    904 │   │   """                                                                               │
│ ❱  905 │   │   return self._apply(lambda t: t.cuda(device))                                      │
│    906 │                                                                                         │
│    907 │   def ipu(self: T, device: Optional[Union[int, device]] = None) -> T:                   │
│    908 │   │   r"""Moves all model parameters and buffers to the IPU.                            │
│                                                                                                  │
│ /usr/local/lib64/python3.11/site-packages/torch/nn/modules/module.py:797 in _apply               │
│                                                                                                  │
│    794 │                                                                                         │
│    795 │   def _apply(self, fn):                                                                 │
│    796 │   │   for module in self.children():                                                    │
│ ❱  797 │   │   │   module._apply(fn)                                                             │
│    798 │   │                                                                                     │
│    799 │   │   def compute_should_use_set_data(tensor, tensor_applied):                          │
│    800 │   │   │   if torch._has_compatible_shallow_copy_type(tensor, tensor_applied):           │
│                                                                                                  │
│ /usr/local/lib64/python3.11/site-packages/torch/nn/modules/module.py:820 in _apply               │
│                                                                                                  │
│    817 │   │   │   # track autograd history of `param_applied`, so we have to use                │
│    818 │   │   │   # `with torch.no_grad():`                                                     │
│    819 │   │   │   with torch.no_grad():                                                         │
│ ❱  820 │   │   │   │   param_applied = fn(param)                                                 │
│    821 │   │   │   should_use_set_data = compute_should_use_set_data(param, param_applied)       │
│    822 │   │   │   if should_use_set_data:                                                       │
│    823 │   │   │   │   param.data = param_applied                                                │
│                                                                                                  │
│ /usr/local/lib64/python3.11/site-packages/torch/nn/modules/module.py:905 in <lambda>             │
│                                                                                                  │
│    902 │   │   Returns:                                                                          │
│    903 │   │   │   Module: self                                                                  │
│    904 │   │   """                                                                               │
│ ❱  905 │   │   return self._apply(lambda t: t.cuda(device))                                      │
│    906 │                                                                                         │
│    907 │   def ipu(self: T, device: Optional[Union[int, device]] = None) -> T:                   │
│    908 │   │   r"""Moves all model parameters and buffers to the IPU.                            │
│                                                                                                  │
│ /usr/local/lib64/python3.11/site-packages/torch/cuda/__init__.py:247 in _lazy_init               │
│                                                                                                  │
│    244 │   │   # are found or any other error occurs                                             │
│    245 │   │   if 'CUDA_MODULE_LOADING' not in os.environ:                                       │
│    246 │   │   │   os.environ['CUDA_MODULE_LOADING'] = 'LAZY'                                    │
│ ❱  247 │   │   torch._C._cuda_init()                                                             │
│    248 │   │   # Some of the queued calls may reentrantly call _lazy_init();                     │
│    249 │   │   # we need to just return without initializing in that case.                       │
│    250 │   │   # However, we must not let any *other* threads in!                                │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
RuntimeError: No CUDA GPUs are available

Ответы

RemiZOffAlex  Создано: 2023-05-25 04:33:57.983009  Обновлено: 2023-05-25 04:33:57.983026

Заменить

.cuda()

на

.cpu()

Возможно будут интересны и другие вопросы