VScode—-debug调试python代码添加上额外命令(args)

问题描述

在服务器上运行python代码时,总会添加上额外的参数一般是用jyputer或者终端直接加上命令,现在我在vscode调试远程代码的时候想要加上这些命令.

file
file

问题解决

打开要调试的主函数打上断点,启动调试

file

此时会报错,我们点击添加配置,修改自动生成的lauch.json
file

将对应的参数存入args即可,"",""分开

{
    // 使用 IntelliSense 了解相关属性。 
    // 悬停以查看现有属性的描述。
    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [

        {
            "name": "Python 调试程序: 当前文件",
            "type": "debugpy",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",

            //添加对应的args
            "args": [
                "--cfg", "./configs/MetaFG_meta_2_384.yaml",
                "--local_rank","0",
                "--batch-size", "10",
                "--tag", "OUTPUT_TAG", 
                "--lr", "5e-3" ,
                "--min-lr" ,"5e-5",
                "--warmup-lr", "5e-4" ,
                "--epochs", "300",
                "--warmup-epochs", "20",
                "--dataset", "cub-200",
                "--output", "output1", 
                "--pretrain", "./premodel/metafg_2_inat21_384.pth"
            ]
        }
    ]
}

在次运行调试可以看到终端已经把额外的命令输入了

file

如果觉得本文对您有所帮助,可以支持下博主,—分也是缘。
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇

超多性价比流量卡,扫码查看

这将关闭于 20