GitHub code, https://github.com/jinghuazhao/tests/blob/main/AI/python/
Command history is ~/.python_history for interactive Python sessions, while use of Python virtural environment is shown in MDL.sh1.
Code extraction is furnished in two steps as follows,
# --> markdown
source rds/software/py3.11/bin/activate
jupyter nbconvert --to markdown Chapter8.ipynb
# --> Python
module load ceuadmin/node/
npm install -g codedown
which codedown
cat Chapter8.md | codedown python > Chapter8.py
Visual Studio code generally does a very good job but it is greatly faciliated by Google Colab, https://colab.research.google.com/. Notably, follow “Runtime” –> “Change runtime type” to enable GPU and/or “Copy path” from the folder listing. In the case of Image_segmentation_pipeline.ipynb, it is also handy to invoke command palette via Ctrl-Shift-P and enter terminal.
One can also post the GitHub address to https://nbviewer.org, e.g., by replacing stable_diffusion.ipynb below with a .ipynb in the folder, e.g., https://nbviewer.org/github/jinghuazhao/tests/blob/main/AI/python/stable_diffusion.ipynb.
It is handy to clone a GitHub repository into Google drive and use it from there, e.g., insert these lines
from google.colab import drive
import os
drive.mount('/content/drive')
BASE = '/content/drive/MyDrive'
REPO = f'{BASE}/DeepLearningCrashCourse'
if not os.path.isdir(REPO):
%cd $BASE
!git clone https://github.com/DeepTrackAI/DeepLearningCrashCourse
%cd $REPO
!ls -R
%cd Ch01_DNN_classification/ec01_1_neuron_class_1d
into neuro_class_1d.ipynb then the notebook can run smoothly.
virtual environment
#!/usr/bin/bash
# Math for Deep Learning, Chapter 10, <https://github.com/rkneusel9/MathForDeepLearning>
module load python/3.9.12/gcc/pdcqf4o5
python -m venv venv
source venv/bin/activate
pip install opencv-python
pip install scikit-learn
pip install keras
pip install tensorflow
python < iris.py
python < nn_by_hand.py
python < mnist.py
# Under VSCode, the virtual environment is also visible once PATH/PYTHONPATH is added.
# notedown ResNet18.md > ResNet18.ipynb
cambridge-ceu fork
There are a number of changes in the forked repository, https://github.com/cambridge-ceu/Ultimate-Neural-Network-Programming-with-Python,
which have now been merged into the master branch. ↩