当前位置:网站首页>pytorch_lightning.utilities.exceptions.MisconfigurationException: You requested GPUs: [1] But...
pytorch_lightning.utilities.exceptions.MisconfigurationException: You requested GPUs: [1] But...
2022-06-27 23:14:00 【Begonia_cat】
报错
pytorch_lightning.utilities.exceptions.MisconfigurationException: You requested GPUs: [1] But your machine only has: [0]
笔者的报错代码:
trainer = Trainer(
max_epochs= config.max_epochs,
gpus= [fix_config.hparams.gpus],
distributed_backend= fix_config.hparams.distributed_backend,
benchmark= fix_config.hparams.benchmark,
deterministic= fix_config.hparams.deterministic,
logger=logger,
callbacks=[
early_stop_callback,
checkpoint_callback
]
)
if __name__ == "__main__":
# 创建解析器
parser = ArgumentParser() #编写命令行接口
parser.add_argument("--gpus", default=1, type=int) # 报错根源
...
这是使用pytorch_lightning框架时遇到的错误。报错说,你想要的GPUs数量为[1],但是你的机器只有[0]个。
看到这个,相信大多数人的第一反应是:
- 欸!报错说我没有gpu!
- 接着去检查一下cuda
注:如果显示cuda为Flase,则表示你没有装cuda或者torch装的是cpu版本,需要重新装一下。笔者在这篇笔记里介绍了配置cuda与相应gpu版本的pytorch、torchvision、torchaudio的辛酸历程,可以作为参考。- cuda是可以用的!所以它为什么说我只有
[0]呢?
笔者最开始也想不通,查阅了少得可怜的资料后,发现这个作者的猜想可能是对的:也就是说,gpu数量是从0开始计数的!
这样一来,重新翻译一下错误:你想要2个GPU,但是你的机器只有1个GPU。
解决办法
把上述代码中,gpu数量改为0。
...
parser.add_argument("--gpus", default=0, type=int)
边栏推荐
- [open source] open source system sorting - Examination Questionnaire, etc
- SQL Server 2016 detailed installation tutorial (with registration code and resources)
- Set collection usage
- 药物发现综述-01-药物发现概述
- 现在炒股网上开户安全吗?新手刚上路,求答案
- 网页鼠标点击特效案例收集(直播间红心同理)
- 力扣今日题-522. 最长特殊序列
- Qu'est - ce que la numérisation? Qu'est - ce que la transformation numérique? Pourquoi les entreprises choisissent - elles la transformation numérique?
- Class文件结构和字节码指令集
- PostgreSQL设置自增字段
猜你喜欢

评价——灰色关联分析

Implementation of timed tasks in laravel framework

Ten thousand words long article understanding business intelligence (BI) | recommended collection

向excel中导入mysql中的数据表

给女朋友看的消息中间件

独立站卖家都在用的五大电子邮件营销技巧,你知道吗?

联想拯救者R720如何组建双通道内存

无人机专用滑环定制要求是什么

Adobe Premiere基础-编辑素材文件常规操作(脱机文件,替换素材,素材标签和编组,素材启用,便捷调节不透明度,项目打包)(十七)

Neural network of zero basis multi map detailed map
随机推荐
Interviewer asked: Inheritance of JS
什么是过孔式导电滑环?
什麼是數字化?什麼是數字化轉型?為什麼企業選擇數字化轉型?
Set collection usage
golang 猴子吃桃子,求第一天桃子的数量
How to build an e-commerce platform at low cost
Flutter SliverAppBar全解析,你要的效果都在这了!
Solon 1.8.3 发布,云原生微服务开发框架
Li Kou today's question -522 Longest special sequence
Message Oriented Middleware for girlfriends
Why stainless steel swivel
现在炒股网上开户安全吗?新手刚上路,求答案
Summary of attack methods of attack team
Form forms and form elements (input, select, textarea, etc.)
数据库查询优化:主从读写分离及常见问题
基于可学习尺寸自适应分子亚结构的药物相互作用预测
LMSOC:一种对社会敏感的预训练方法
Review of drug discovery-02-prediction of molecular properties
有监督、无监督与半监督学习
[open source] open source system sorting - Examination Questionnaire, etc
