munhouiani / Deep-Packet

Pytorch implementation of deep packet: a novel approach for encrypted traffic classification using deep learning
MIT License
183 stars 56 forks source link

GPUs requested but none are available. #4

Closed Cyan95 closed 3 years ago

Cyan95 commented 3 years ago

我的机器有显卡GeForce GTX 1080Ti,按照Dockerfile搭建了本地环境,train_cnn.py不使用GPU时可以运行,但启用GPU运行会报错。

pytorch_lightning.utilities.exceptions.MisconfigurationException: GPUs requested but none are available.

已安装了nvidia驱动,cuda和cudnn。

qianwang102 commented 3 years ago

你好,请问你是在windows系统还是在虚拟机上搭建环境的?

Cyan95 commented 3 years ago

你好,请问你是在windows系统还是在虚拟机上搭建环境的?

我在ubuntu 18.04里搭建的环境。 我遇到的问题是torch.cuda.is_available()总是False,似乎是因为conda的虚拟环境拉取的pytorch总是cpu版的。 后来尝试直接pip安装解决了。

munhouiani commented 3 years ago

我當初的環境是只有 CPU 的 server,因此 Dockerfile 裡面安裝的是 CPU 版的 PyTorch (注意裡面有個 cpuonly),如果你需要用到 GPU 的話必須要拿掉 cpuonly

可以看看官網的安裝建議 https://pytorch.org/get-started/locally/