Vs Code Python and Colab Jupyter Notebook Co-work
Vs Code Python and Colab Jupyter Notebook have their own advantages.
Vs Code Python:
- very good debugging environment including breakpoint, watch function.
- use local GPU card to save money
Jupyter
- Python file compatible
- Use remote GPU with better performance
- Interactive debugging without recompile
Here’s a comparison table summarizing the features of VS Code and Jupyter for Python development:
| Feature | VS Code | Jupyter |
|---|---|---|
| Debugging Environment | Very good debugging with breakpoints and watch functions | Interactive debugging without recompilation |
| GPU Utilization | Uses local GPU card to save money | Uses remote GPU with better performance |
| File Compatibility | Supports Python files | Compatible with Python files |
| Interactivity | Less interactive, primarily code-based | Highly interactive with notebooks |
| File comparison | Easy for TEXT file, diff or BeyongCompare | JSON file, diffcult to compare |
How to Avoid Two Copy of Files?
Apparently we don’t really want to keep track two copies of files, VS Code python and Colab Jupyter Notebook (ipynb). However, there are two different file formats.
A good way is to make the python code to be function only for importing. The test code can be either using if __name__ == "__main__": code block, or use test folder. This is a standard procedure so that I won’t explain it.
On the other hand, the Colab Jupyter notebook needs some work.
Mount Local Folder
1 | |
Change Directory for Import
1 | |
Import related python and packages
The first line is the most important part!
1 | |
Command Line Argement
1 | |
Visualize transformer tensor shape and validate
A very good tools is summary
1 | |