如何使用vscode的launch.json来debug调试
1、创建一个launch.json文件
选择Python Debugger
,再选择Python
文件,创建处理如下
默认有下面五个参数
"name": "Python Debugger: Current File",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
修改“program”
路径:使用“workspaceFolder”
开启调试:
调试结果:
一些复杂的调试可能会如下:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Experiment Runner",
//"type": "debugpy",
"type": "python",
"request": "launch",
//"program": "${file}",
"program": "${workspaceFolder}/driving/configs/_base_/models/B_efficientnetlite_H_roadclsdecoder.py",
"console": "integratedTerminal",
// new
"cwd":"${workspaceFolder}",
// 如果是false的话就会进到别的子程序里面,为了调试的直观,
// 设置true比较好, true就是调试的范围都是你写的代码
"justMyCode":true,
// 环境
"env":{"CUDA_VISILBE_DEVICES":"0",
// 开启断言assert
"TORCH_USE_CUDA_DSA":"ON"},
// 训练参数细节
"args": [
"--task_name", "CoLA",
"--do_train", "true",
"--do_eval", "true",
"--data_dir", "glue_data/CoLA",
"--vocab_file", "uncased_L-2_H-128_A-2/vocab.txt",
"--bert_config_file", "uncased_L-2_H-128_A-2/bert_config.json",
"--init_checkpoint", "uncased_L-2_H-128_A-2/bert_model.ckpt",
"--max_seq_length", "128" ,
"--train_batch_size", "32",
"--learning_rate", "2e-5" ,
"--num_train_epochs", "3.0" ,
"--output_dir", "tmp/CoLA_output"
]
}
]
}
原文地址:https://blog.csdn.net/m0_51579041/article/details/142869632
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!