fastnlp / fastNLP

fastNLP: A Modularized and Extensible NLP Framework. Currently still in incubation.
https://gitee.com/fastnlp/fastNLP
Apache License 2.0
3.06k stars 450 forks source link

ubuntu 18.4 python3.8 #305

Closed songsh closed 4 years ago

songsh commented 4 years ago

trainer = Trainer(data_bundle.get_dataset('train'), model, loss=loss, optimizer=optimizer, File "/home/dony/.local/lib/python3.8/site-packages/fastNLP/core/trainer.py", line 500, in init self.model = _move_model_to_device(model, device=device) File "/home/dony/.local/lib/python3.8/site-packages/fastNLP/core/utils.py", line 424, in _move_model_to_device

assert torch.cuda.device_count() > device, "Only has {} gpus, cannot use device {}.".format( AssertionError: Only has 0 gpus, cannot use device 0.

yhcc commented 4 years ago

就是说没有检测到可用gpu,但是却申明要用gpu。把trainer的device修改为None可以规避这个问题。如果您的电脑确实有gpu,这可能是(1) 显卡驱动没安装好, 可以通过nvidia-smi检查; (2) pytorch装成了cpu版本.