pytorch_lightning_报错及解决记录1:usage和版本问题

版本:python3.9.17 + pytorch2.0.1 + lightning2.0.9

1. 报错一:

>usage: run.py [-h] [-c CONFIG] [--print_config[=flags]]
              {fit,validate,test,predict} ...
>run.py: error: 'expected "subcommand" to be one of {fit,validate,test,predict}, but it was not provided.'

1. 运行代码和报错截图:

2. 具体报错:

usage: run.py [-h] [-c CONFIG] [--print_config[=flags]]
              {fit,validate,test,predict} ...
run.py: error: 'expected "subcommand" to be one of {fit,validate,test,predict}, but it was not provided.'

3. 问题分析:usage,用法出错,需要在终端运行如图提示中的代码形式

4. 问题解决:

python run.py -c config/配置文件名字.yaml fit

5. 具体代码: 

 python run.py -c config/unet_stl10.yaml fit

 2. 报错二:

>run.py: error: 'Configuration check failed :: No action for destination key "trainer.num_processes" to check its value.'

适用版本:1.9.0

我的版本:2.0.1

解决方法:重建环境 ---> python3.9.17+pytorch_lightning1.9.0+pl自带pytorch。

总结: 以后遇到 可以换版本解决的问题 直接换版本,不要浪费时间。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
ModuleNotFoundError: No module named 'pytorch_lightning'错误是因为在运行代码时找不到pytorch_lightning模块。根据引用和引用[2]的内容,pytorch_lightning.metric已被废弃,部分函数和包被作者放到了另一个包中,需要单独安装。安装pytorch_lightning并不会默认安装这个包。 为了解决这个问题,您需要单独安装这个包。您可以使用以下命令来安装这个包: - 使用pip安装:pip install torchmetrics - 使用conda安装:conda install -c conda-forge torchmetrics 安装完成后,您就可以在您的代码中使用torchmetrics模块来替代pytorch_lightning.metric了。这样,即使您不想使用pytorch_lightning,也可以在pytorch的模型中使用该模块。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [(已解决)ModuleNotFoundError: No module named ‘pytorch_lightning.metrics](https://blog.csdn.net/qq_43391414/article/details/124412694)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *3* [如何解决ModuleNotFoundError: No module named ‘pytorch_lightning.metrics](https://blog.csdn.net/lyf6667/article/details/125673107)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值