Closed aleksandr294 closed 3 years ago
Отключите работу с CUDA с помощью переменной окружения: Для этого замените этот код
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
os.environ["TF_FORCE_GPU_ALLOW_GROWTH"]="true"
этим
os.environ["CUDA_VISIBLE_DEVICES"] = ""
Спасибо.
@ApelSYN при запуске кода на Google Colab возникает такая же ошибка и на CPU и на GPU, то есть os.environ["CUDA_VISIBLE_DEVICES"] = "" не решает проблемы. Ошибка: RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.
Ошибка может возникать из-за некорректной версии torch и torchvision, убедитесь в том что torch версии 1.6, torchvision версии 0.7.0, вот так можно все поправить:
pip3 install torch==1.6
pip3 install torchvision==0.7.0
Автор centermask2 рофиксил проблему совместимости -- должно работать со свежими версичми torch и torchvision pip3 install "torch>=1.6" pip3 install "torchvision>=0.7"
Переоткройте это issue если проблема еще не решена.
2020-11-03 06:47:27.453771: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found 2020-11-03 06:47:27.454030: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. 2020-11-03 06:47:29.386906: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x1c9168a3260 initialized for platform Host (this does not guarantee that XLA will be used). Devices: 2020-11-03 06:47:29.387188: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version 2020-11-03 06:47:29.388538: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found 2020-11-03 06:47:29.388779: W tensorflow/stream_executor/cuda/cuda_driver.cc:312] failed call to cuInit: UNKNOWN ERROR (303) 2020-11-03 06:47:29.392588: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: DESKTOP-2M99F75 2020-11-03 06:47:29.392850: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: DESKTOP-2M99F75 Config 'C:\Users\balas\PycharmProjects\pythonProject\nomeroff-net./NomeroffNet/configs/centermask2/numberplates/cpu_centermask_numberplate_V_39_eSE_FPN_ms_3x.yaml' has no VERSION. Assuming it to be compatible with latest v2. Traceback (most recent call last): File "C:/Users/balas/PycharmProjects/pythonProject/main.py", line 42, in
cv_imgs_masks = nnet.detect_mask([img])
File "C:\Users\balas\PycharmProjects\pythonProject\nomeroff-net\NomeroffNet\DetectronDetector.py", line 75, in detect_mask
outputs = self.predictor(im)
File "C:\Users\balas\PycharmProjects\pythonProject\venv\lib\site-packages\detectron2\engine\defaults.py", line 223, in call
predictions = self.model([inputs])[0]
File "C:\Users\balas\PycharmProjects\pythonProject\venv\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl
result = self.forward(*input, *kwargs)
File "C:\Users\balas\PycharmProjects\pythonProject\venv\lib\site-packages\detectron2\modeling\meta_arch\rcnn.py", line 149, in forward
return self.inference(batched_inputs)
File "C:\Users\balas\PycharmProjects\pythonProject\venv\lib\site-packages\detectron2\modeling\metaarch\rcnn.py", line 202, in inference
proposals, = self.proposal_generator(images, features, None)
File "C:\Users\balas\PycharmProjects\pythonProject\venv\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl
result = self.forward(input, **kwargs)
File "C:\Users\balas\PycharmProjects\pythonProject\nomeroff-net\centermask2\centermask\modeling\fcos\fcos.py", line 117, in forward
proposals = outputs.predict_proposals()
File "C:\Users\balas\PycharmProjects\pythonProject\nomeroff-net\centermask2\centermask\modeling\fcos\fcos_outputs.py", line 362, in predict_proposals
l, o, r, c, self.image_sizes
File "C:\Users\balas\PycharmProjects\pythonProject\nomeroff-net\centermask2\centermask\modeling\fcos\fcos_outputs.py", line 390, in forward_for_single_feature_map
pre_nms_top_n = candidate_inds.view(N, -1).sum(1)
Запуск происходит без GPU. Буду очень благодарен в решении данной проблемы.