- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我在 ubuntu 16.04 中运行脚本时遇到此错误。请耐心等待,我是 python 的新手,我已经检查了互联网上已经可用的选项,但我无法修复它。
RuntimeError: cuda runtime error (10) : invalid device ordinal at torch/csrc/cuda/Module.cpp:32
我目前正在运行这个文件。
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)
validator = Validator(options)
for epoch in range(options["training"]["startepoch"], options["training"]["epochs"]):
if(options["training"]["train"]):
trainer.epoch(model, epoch)
if(options["validation"]["validate"]):
validator.epoch(model)
我怀疑这个文件与弹出的错误有关
Title = "TOML Example"
[general]
usecudnn = true
usecudnnbenchmark = true
gpuid = 0
loadpretrainedmodel = true
pretrainedmodelpath = "trainedmodel.pt"
savemodel = true
modelsavepath = "savedmodel.pt"
[input]
batchsize = 18
numworkers = 18
shuffle = true
[model]
type = "LSTM"
inputdim = 256
hiddendim = 256
numclasses = 500
numlstms = 2
[training]
train = true
epochs = 15
startepoch = 10
statsfrequency = 1000
dataset = "/udisk/pszts-ssd/AV-ASR-data/BBC_Oxford/lipread_mp4"
learningrate = 0.003
momentum = 0.9
weightdecay = 0.0001
[validation]
validate = true
dataset = "/udisk/pszts-ssd/AV-ASR-data/BBC_Oxford/lipread_mp4"
saveaccuracy = true
accuracyfilelocation = "accuracy.txt"
错误主要出现在我终于到达的 gpuid 行。
最佳答案
尝试这样做
import torch
print(torch.cuda.is_available())
如果输出为 False,则表示 PyTorch 未检测到 GPU。我遇到了同样的问题,重新安装 Pytorch 对我有用。您可能还想看看这个 https://github.com/pytorch/pytorch/issues/6098 .
关于python - 无效的设备序号,CUDA/TORCH,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50783853/
这个问题在这里已经有了答案: Batch renaming files with Bash (10 个答案) 关闭 6 年前。 我想将包含子目录的目录中的文件重命名为父目录名称+序号。 例如: he
我需要帮助! HTML 最佳答案 试试这个 var array = document.getElementById('wrapperDiv'); for (var i = 0, len = a
我正在本地主机上安装 SSL。当我尝试运行时 openssl genrsa -aes256 -out private.key 2048 cmd 中的命令,我收到错误警告。 The ordinal 3
我想做(某种程度上)与 this old post 相反的事情是关于; 这是我的示例表: ID NAME ---- ---- 1 Apple 2 Apple 3 Apple
我读过一些不错的帖子,比如 this one它解释了在给定 int 时接收序数的方法。 现在,我有一个 LocalDate 对象,我可以使用我的 Thymeleaf 模板中的任何 DateTimeFo
我是解码器和 FFmpeg 的新手。我需要的是实现可以通过某个步骤读取帧的逻辑(例如:20),换句话说,我有一个文件,我需要读取帧 0、20、40、60 ...... 我所做的是 AVFrame *
我安装了 "mysql-installer-community-8.0.16.0.msi" .安装期间一切顺利。我什至可以为我的项目创建一个新的数据库和表。我在 C++ 中使用它。编译和链接一切顺利。
有谁知道传递给 dwmapi.dll 序号 #113 的参数是什么? (Windows 7) 我正在尝试将此方法合并到我正在编写的应用程序中。据我所知,此方法负责为 Windows 执行 Aero p
我有一个在 Hibernate 的 EntityManager 中管理的实体。这个实体确实有一个由 ENUM 表示的状态。 Hibernate 确实将数据库中的 ENUM 值保存为整数。 当 ENUM
关于我的问题:Detect the the vtable offset of a specific virtual function (using Visual C++) : 给定: struct A
我刚刚在 Windows 10 上安装了 Anaconda 5.3 64 位 (Anaconda3-5.3.0-Windows-x86_64),但在尝试运行 Spyder 时出现此错误。 python
我是一名优秀的程序员,十分优秀!