Skip to content

Commit

Permalink
Use shallow git clones in colab notebooks
Browse files Browse the repository at this point in the history
- Makes the clone operation much faster
- Reduces the size of the clone without
- Minimal risk of impacting the functionality
  of the notebooks, which do not operate on the
  Git history
- If a reader can't use shallow clones, it's
  self-documenting what to change
  • Loading branch information
mdlinville committed Feb 13, 2025
1 parent 63739b7 commit c71ae99
Show file tree
Hide file tree
Showing 16 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions colabs/convnext/Finetune_ConvNext_on_CIFAR10_using_W&B.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"metadata": {},
"outputs": [],
"source": [
"!git clone https://github.com/facebookresearch/ConvNeXt"
"!git clone --depth 1 https://github.com/facebookresearch/ConvNeXt"
]
},
{
Expand Down Expand Up @@ -80,7 +80,7 @@
"metadata": {},
"outputs": [],
"source": [
"!git clone https://github.com/YoongiKim/CIFAR-10-images"
"!git clone --depth 1 https://github.com/YoongiKim/CIFAR-10-images"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion colabs/kaolin_wisp/VQAD.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"%cd ..\n",
"\n",
"# Install Kaolin-Wisp\n",
"!git clone https://github.com/NVIDIAGameWorks/kaolin-wisp\n",
"!git clone --depth 1 https://github.com/NVIDIAGameWorks/kaolin-wisp\n",
"%cd kaolin-wisp\n",
"!pip install -q -r requirements.txt\n",
"!pip install -q --upgrade wandb\n",
Expand Down
2 changes: 1 addition & 1 deletion colabs/keras/keras_core/monai_medmnist_keras.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"# install the `main` branch of KerasCore\n",
"!pip install -qq namex\n",
"!apt install python3.10-venv\n",
"!git clone https://github.com/soumik12345/keras-core.git && cd keras-core && python pip_build.py --install\n",
"!git clone --depth 1 https://github.com/soumik12345/keras-core.git && cd keras-core && python pip_build.py --install\n",
"\n",
"# install monai and wandb-addons\n",
"!pip install -qq git+https://github.com/soumik12345/wandb-addons\n",
Expand Down
2 changes: 1 addition & 1 deletion colabs/keras/keras_core/timm_keras.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"# install the `main` branch of KerasCore\n",
"!pip install -qq namex\n",
"!apt install python3.10-venv\n",
"!git clone https://github.com/soumik12345/keras-core.git && cd keras-core && python pip_build.py --install\n",
"!git clone --depth 1 https://github.com/soumik12345/keras-core.git && cd keras-core && python pip_build.py --install\n",
"\n",
"# install timm and wandb-addons\n",
"!pip install -qq git+https://github.com/soumik12345/wandb-addons"
Expand Down
2 changes: 1 addition & 1 deletion colabs/keras/keras_core/torchvision-keras.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"# install the `main` branch of KerasCore\n",
"!pip install -qq namex\n",
"!apt install python3.10-venv\n",
"!git clone https://github.com/soumik12345/keras-core.git && cd keras-core && python pip_build.py --install\n",
"!git clone --depth 1 https://github.com/soumik12345/keras-core.git && cd keras-core && python pip_build.py --install\n",
"\n",
"# install wandb-addons\n",
"!pip install -qq git+https://github.com/soumik12345/wandb-addons"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"outputs": [],
"source": [
"%%shell\n",
"git clone https://github.com/PaddlePaddle/PaddleDetection\n",
"git clone --depth 1 https://github.com/PaddlePaddle/PaddleDetection\n",
"python -m pip install paddlepaddle-gpu==2.3.2.post112 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html\n",
"pip install pyclipper attrdict gdown -qqq\n",
"cd PaddleDetection\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"outputs": [],
"source": [
"\n",
"!git clone https://github.com/PaddlePaddle/PaddleOCR\n",
"!git clone --depth 1 https://github.com/PaddlePaddle/PaddleOCR\n",
"!python -m pip install paddlepaddle-gpu==2.3.2.post112 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html\n",
"!pip install pyclipper attrdict opencv-python shapely scikit-image imgaug -qqq\n",
"!cd PaddleOCR && pip install -r requirements.txt && pip install -e ."
Expand Down
6 changes: 3 additions & 3 deletions colabs/stylegan_nada/StyleGAN-NADA.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"metadata": {},
"outputs": [],
"source": [
"!git clone https://github.com/yuval-alaluf/restyle-encoder.git $restyle_dir\n",
"!git clone --depth 1 https://github.com/yuval-alaluf/restyle-encoder.git $restyle_dir\n",
"\n",
"!wget https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip\n",
"!sudo unzip ninja-linux.zip -d /usr/local/bin/\n",
Expand All @@ -71,8 +71,8 @@
"!pip install ftfy regex tqdm wandb\n",
"!pip install git+https://github.com/openai/CLIP.git\n",
"\n",
"!git clone https://github.com/NVlabs/stylegan2-ada/ $stylegan_ada_dir\n",
"!git clone https://github.com/rinongal/stylegan-nada.git $stylegan_nada_dir"
"!git clone --depth 1 https://github.com/NVlabs/stylegan2-ada/ $stylegan_ada_dir\n",
"!git clone --depth 1 https://github.com/rinongal/stylegan-nada.git $stylegan_nada_dir"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion colabs/torchtune/torchtune_and_wandb.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"metadata": {},
"outputs": [],
"source": [
"!git clone https://github.com/pytorch/torchtune"
"!git clone --depth 1 https://github.com/pytorch/torchtune"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"!pip install wandb -qq\n",
"\n",
"# Fetch audio, video and other data files to log\n",
"!git clone https://github.com/wandb/examples.git\n",
"!git clone --depth 1 https://github.com/wandb/examples.git\n",
"!pip install soundfile -qq\n",
"\n",
"import warnings\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"outputs": [],
"source": [
"#@title Setup\n",
"! git clone https://github.com/kuprel/min-dalle\n",
"! git clone --depth 1 https://github.com/kuprel/min-dalle\n",
"! git lfs install\n",
"! git clone https://huggingface.co/dalle-mini/vqgan_imagenet_f16_16384 /content/min-dalle/pretrained/vqgan\n",
"!pip install torch flax==0.4.2 wandb\n",
Expand Down
2 changes: 1 addition & 1 deletion colabs/yolo/Logging_YOLOv5_Experiments_with_W&B.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"metadata": {},
"outputs": [],
"source": [
"!git clone https://github.com/ultralytics/yolov5 # clone repo\n",
"!git clone --depth 1 https://github.com/ultralytics/yolov5 # clone repo\n",
"%cd yolov5\n",
"%pip install -qr requirements.txt # install dependencies\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"outputs": [],
"source": [
"%%capture\n",
"!git clone https://github.com/ultralytics/yolov5.git\n",
"!git clone --depth 1 https://github.com/ultralytics/yolov5.git\n",
"%cd /content/yolov5\n",
"!pip install -r requirements.txt\n",
"!pip install wandb==0.12.10"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"outputs": [],
"source": [
"%%capture\n",
"!git clone https://github.com/ultralytics/yolov5.git\n",
"!git clone --depth 1 https://github.com/ultralytics/yolov5.git\n",
"!curl -L \"https://public.roboflow.com/ds/1BpjFZe9ST?key=KXD7eDvwTa\" > roboflow.zip; unzip -o roboflow.zip; rm roboflow.zip\n",
"%cd /content/yolov5\n",
"!pip install -r requirements.txt\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"outputs": [],
"source": [
"%%capture\n",
"!git clone https://github.com/ultralytics/yolov5.git\n",
"!git clone --depth 1 https://github.com/ultralytics/yolov5.git\n",
"!curl -L \"https://app.roboflow.com/ds/5F7B42TQI7?key=VhVxco4lnb\" > roboflow.zip; unzip roboflow.zip; rm roboflow.zip\n",
"%cd /content/yolov5\n",
"!pip install -r requirements.txt\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"outputs": [],
"source": [
"%%shell\n",
"git clone https://github.com/manangoel99/YOLOX\n",
"git clone --depth 1 https://github.com/manangoel99/YOLOX\n",
"cd YOLOX\n",
"git config --global user.name \"Manan Goel\"\n",
"git config --global user.email \"[email protected]\"\n",
Expand Down

0 comments on commit c71ae99

Please sign in to comment.