【异常错误】Unexpected option: --local_rank=0(pycharm可以run但是不可以debug)

这篇具有很好参考价值的文章主要介绍了【异常错误】Unexpected option: --local_rank=0(pycharm可以run但是不可以debug)。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

今天在使用用run运行shell文件转为的cmd命令后,run可以正常运行,但是debug却出现问题,错误信息:

Usage:
	pydevd.py --port N [(--client hostname) | --server] --file executable [file_options]
Traceback (most recent call last):
  File "/home/mapengsen/.pycharm_helpers/pydev/pydevd.py", line 2016, in main
    setup = process_command_line(sys.argv)
  File "/home/mapengsen/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_command_line_handling.py", line 146, in process_command_line
    raise ValueError("Unexpected option: " + argv[i])
ValueError: Unexpected option: --local_rank=0
[2023-07-08 10:08:11,202] [INFO] [launch.py:315:sigkill_handler] Killing subprocess 2934
[2023-07-08 10:08:11,202] [ERROR] [launch.py:321:sigkill_handler] ['/home/mapengsen/anaconda3/envs/38/bin/python', '-u', '/home/mapengsen/.pycharm_helpers/pydev/pydevd.py', '--local_rank=0', '--multiprocess', '--qt-support=auto', '--client', '127.0.0.1', '--port', '58899', '--file', '/mnt/d/Pycharm_workspace/DoubleTarget/RetMol/MolBART/train_retrieval.py', '--model-parallel-size', '1', '--pipe-parallel-size', '0', '--num-layers', '4', '--hidden-size', '256', '--num-attention-heads', '8', '--seq-length', '512', '--max-position-embeddings', '512', '--batch-size', '320', '--gas', '16', '--train-iters', '50000', '--lr-decay-iters', '320000', '--data-impl', 'mmap', '--distributed-backend', 'nccl', '--lr', '0.0001', '--lr-decay-style', 'cosine', '--min-lr', '1.0e-5', '--weight-decay', '0', '--clip-grad', '1.0', '--warmup', '0.01', '--checkpoint-activations', '--log-interval', '1', '--save-interval', '10000', '--eval-interval', '50000', '--eval-iters', '10', '--fp16', '--dataset_path', '../data/zinc.tab', '--deepspeed', '--deepspeed_config', 'megatron_molbart/ds_config.json', '--zero-stage', '1', '--zero-reduce-bucket-size', '50000000', '--zero-allgather-bucket-size', '5000000000', '--zero-reduce-scatter', '--checkpoint-activations', '--checkpoint-num-layers', '1', '--partition-activations', '--synchronize-each-layer', '--contigious-checkpointing', '--stage', '1', '--train_from', 'pretrain', '--model_ckpt_itr', '50000', '--attr', 'logp-sa', '--attr_offset', '0', '--data_source', 'jtnn', '--enumeration_input', 'false', '--retriever_rule', 'random', '--pred_target', 'reconstruction', '--n_retrievals', '10', '--n_neighbors', '100'] exits with return code = 1

Process finished with exit code 1

我再网上查了以后大多数说是因为分布式的原因,可能是因为我使用了deepspeed,所以导致了分布式的问题吧,

此时参考文章:pycharm终止运行_Pycharm 下如何 debug torch.distributed_祁圆圆的博客-CSDN博客

方法说起来很简单,只需要在 Pycharm 的 Configuration 中作一些设置即可:

  • 打开 Run -> Edit Configurations...
  • Script path 不再是你自己代码的路径,而是 launch.py 文件的保存路径,例如我的是:
\\wsl$\Ubuntu-18.04\home\mapengsen\anaconda3\envs\38\lib\python3.8\site-packages\torch\distributed\launch.py
  • 设置 Parameters:
--nproc_per_node=1 main.py
  • 在 Environment variables 中添加 CUDA_VISIBLE_DEVICES=0,1 。
  • 把interpreter options中的deepspeed部分删除(因为现在使用了distribution.launch.py作为script path )
  • 剩下的 Python interpreter 和 Working directory 就按照通常情况来设置即可。

经过这些步骤,就可以在 Pycharm 中 debug 分布式训练的代码了。

如何配置parameters,看:https://blog.csdn.net/weixin_43135178/article/details/130039607

【异常错误】Unexpected option: --local_rank=0(pycharm可以run但是不可以debug),python异常错误,pycharm,ide,python

 【异常错误】Unexpected option: --local_rank=0(pycharm可以run但是不可以debug),python异常错误,pycharm,ide,python文章来源地址https://www.toymoban.com/news/detail-536612.html

到了这里,关于【异常错误】Unexpected option: --local_rank=0(pycharm可以run但是不可以debug)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 【异常错误】pycharm copilot 错误:detected dubious ownership in repository ****** is owned by: 修改后无显示

    今天在github git的时候,突然出现了这种问题,下面的框出的部分一直显示: detected dubious ownership in repository at \\\'D:/Pycharm_workspace/SBDD/1/FLAG\\\' \\\'D:/Pycharm_workspace/SBDD/1/FLAG\\\' is owned by: \\\'S-1-5-32-544\\\' but the current user is: \\\'S-1-5-21-4177494839-3217565356-2102511185-500\\\' To add an exception for this directory, call

    2024年01月16日
    浏览(25)
  • 已解决(selenium操作火狐浏览器报错)TypeError: __init__() got an unexpected keyword argument ‘firefox_options‘

    已解决(selenium操作火狐浏览器报错)TypeError: init () got an unexpected keyword argument ‘firefox_options‘ 粉丝群里面的一个小伙伴想用selenium操作火狐浏览器,但是发生了报错(当时他心里瞬间凉了一大截,跑来找我求助,然后顺利帮助他解决了,顺便记录一下希望可以帮助到更多遇

    2024年02月09日
    浏览(24)
  • OkHttp抛出异常java.net.ProtocolException: unexpected end of stream

    今天用okHttp写了个从本地的Apache服务器上下载资源的安卓app,然后发现偶尔的下载会抛出java.net.ProtocolException: unexpected end of stream的异常,苦思不得结果后上百度查找,百度有很多分析,有可能的原因是响应头Content-length和实体长度不同,找到几个方法,有的说在请求头中添加

    2024年02月16日
    浏览(29)
  • 解决 eslint 的 Parsing error: Unexpected token 错误

    解决 eslint 的 Parsing error: Unexpected token 错误 问题描述:import动态导入,将js文件单独打包时,webpack打包错误 ERROR in ./src/js/main.js Module Error (from ./node_modules/_eslint-loader@4.0.2@eslint-loader/dist/cjs.js ): F:workspacejavascript workspacewebpackprj18_3srcjsmain.js 8:7 error Parsing error: Unexpected token (

    2024年02月05日
    浏览(17)
  • Python异常处理TypeError: translation() got an unexpected keyword argument ‘codeset‘

    学习graphql-python安装好依赖后执行命令 仅接着出现下列错误,主要提示是 「TypeError: translation() got an unexpected keyword argument ‘codeset’」 根据异常栈定位到源代码位置 /Users/software_1/miniconda3/envs/learnLangchain/lib/python3.11/site-packages/django/utils/translation/trans_real.py,代码调用python方法传

    2024年02月03日
    浏览(52)
  • 异常 :Unexpected error occurred in scheduled task 。 Spring Boot定时任务调度注解@scheduled

           前言: @Scheduled 注解是 Spring Boot 提供的用于定时任务控制的注解,主要用于控制任务在某个指定时间执行,或者每隔一段时间执行        异常: Unexpected error occurred in scheduled task :计划任务发生意外错误 这个bug是偶然一次遇见的,当时觉得这个描述很简单,肯定

    2024年02月12日
    浏览(26)
  • 深入理解Local Outlier Factor(LOF)局部异常因子算法

    首先,写这篇文章的初衷是为了记录自身对LOF的理解,另一个原因是个人在学习该算法的时候,也查阅过不少的文章或者视频,有一些知识点(如可达距离、局部可达密度等概念)可能并没有清晰的表达出来,因此该文章本着个人对该算法的理解记录学习该算法的过程,如有错

    2024年02月06日
    浏览(24)
  • npm安装yarn报npm ERR Unexpected token ‘.‘错误的解决办法

    问题背景 最近发现很多前端框架或前端产品的学习和使用都用到了yarn,一开始不知道这是干什么的,后在网上搜索说是JS包管理工具,我一致都是用的nodeJs,难道node过时了,然后有一顿搜索,网上是这么介绍的。 Yarn是什么? “Yarn是由Facebook、Google、Exponent 和 Tilde 联合推出

    2024年02月01日
    浏览(19)
  • PyCharm 本地终端用不了报错can‘t open local...(已解决)

    今天打开pycharm ,发现终端用不了,一直显示 can\\\'t   open  local,具体报错情况如下:   在查阅资料后,我 先是在 设置了powershell路径,未解决 C:WindowsSystem32WindowsPowerShellv1.0powershell.exe  其次,又尝试了一种方法, 设置cmd路径,还是未解决 环境变量Path中添加了  Powershel

    2024年02月02日
    浏览(59)
  • Pytorch——报错解决:多卡训练超时错误Timed out initializing process group in store based barrier on rank

    找到 .conda/envs/bevdet/lib/python3.6/site-packages/torch/distributed/constants.py ,修改默认时间从 30mins 到 120mins :

    2024年02月12日
    浏览(27)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包