How to make VScode launch.json for a Python module

We Are Going To Discuss About How to make VScode launch.json for a Python module. So lets Start this Python Article.

How to make VScode launch.json for a Python module

  1. How to solve How to make VScode launch.json for a Python module

    Specify the module you want to run with "module": "torch.distributed.launch"
    You can ignore the -m flag. Put everything else under the args key.
    Note: Make sure to include --nproc_per_node and the name of file (main_swav.py) in the list of arguments
    { "version": "0.2.0", "configurations": [ { "name": "Python: Current File", "type": "python", "module": "torch.distributed.launch", "request": "launch", "console": "integratedTerminal", "args": [ "--nproc_per_node", "1", "main_swav.py", "--data_path", "/dataset/imagenet/train", ] } ] }
    Read more here: https://code.visualstudio.com/docs/python/debugging#_module

  2. How to make VScode launch.json for a Python module

    Specify the module you want to run with "module": "torch.distributed.launch"
    You can ignore the -m flag. Put everything else under the args key.
    Note: Make sure to include --nproc_per_node and the name of file (main_swav.py) in the list of arguments
    { "version": "0.2.0", "configurations": [ { "name": "Python: Current File", "type": "python", "module": "torch.distributed.launch", "request": "launch", "console": "integratedTerminal", "args": [ "--nproc_per_node", "1", "main_swav.py", "--data_path", "/dataset/imagenet/train", ] } ] }
    Read more here: https://code.visualstudio.com/docs/python/debugging#_module

Solution 1

Specify the module you want to run with "module": "torch.distributed.launch"

You can ignore the -m flag. Put everything else under the args key.

Note: Make sure to include --nproc_per_node and the name of file (main_swav.py) in the list of arguments

{
            "version": "0.2.0",
            "configurations": [
                {
                    "name": "Python: Current File",
                    "type": "python",
                    "module": "torch.distributed.launch",
                    "request": "launch",
                    "console": "integratedTerminal",
                    "args": [
                        "--nproc_per_node", "1", 
                        "main_swav.py",
                        "--data_path", "/dataset/imagenet/train",
                    ]
                }
            ]
        }

Read more here: https://code.visualstudio.com/docs/python/debugging#_module

Original Author Matt Spataro Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

ittutorial team

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment