小编vik*_*ari的帖子

无效的设备序号,CUDA/TORCH

在 ubuntu 16.04 中运行脚本时出现此错误。请耐心等待,我是 python 新手,我已经检查了互联网上已经可用的选项,但我无法修复它。

 RuntimeError: cuda runtime error (10) : invalid device ordinal at torch/csrc/cuda/Module.cpp:32
Run Code Online (Sandbox Code Playgroud)

我目前正在运行这个文件。

from __future__ import print_function
from models import LipRead
import torch
import toml
from training import Trainer
from validation import Validator

print("Loading options...")
with open('options.toml', 'r') as optionsFile:
options = toml.loads(optionsFile.read())

if(options["general"]["usecudnnbenchmark"] and options["general"]    ["usecudnn"]):
print("Running cudnn benchmark...")
torch.backends.cudnn.benchmark = True

#Create the model.
model = LipRead(options)

if(options["general"]["loadpretrainedmodel"]):
model.load_state_dict(torch.load(options["general"]    ["pretrainedmodelpath"]))

#Move the model to the GPU.
if(options["general"]["usecudnn"]):
model = model.cuda(options["general"]["gpuid"])

trainer = Trainer(options) …
Run Code Online (Sandbox Code Playgroud)

python gpu pytorch

7
推荐指数
1
解决办法
9928
查看次数

标签 统计

gpu ×1

python ×1

pytorch ×1