How to Use Sparse Git Checkout to Clone the AI for Beginners Repository Without Translations
Use git clone --filter=blob:none --sparse followed by git sparse-checkout set --no-cone '/*' '!translations' '!translated_images' to download only the core curriculum while excluding the 50+ language translation directories.
The microsoft/AI-For-Beginners repository contains a comprehensive AI curriculum with Jupyter notebooks, Python examples, and a Vue.js quiz application. However, it also includes extensive translation files and localized image assets that inflate the repository size to several hundred megabytes. By using sparse git checkout, you can create a lightweight clone containing only the essential lessons, code examples, and environment configuration files while skipping the translations/ and translated_images/ directories entirely.
Why Use Sparse Checkout for AI for Beginners?
The repository architecture separates core educational content from localization assets. The translations/ directory holds markdown lesson files for over 50 languages, while translated_images/ stores language-specific visual assets. These folders are unnecessary if you are working with the English curriculum.
Key benefits of sparse checkout:
- Reduced download size – Eliminates hundreds of megabytes of translation data
- Faster cloning – Ideal for low-bandwidth connections or CI/CD pipelines
- Focused workspace – Removes visual clutter from non-English lesson files
The core curriculum resides in lessons/, examples/, etc/quiz-app/, and configuration files like environment.yml and requirements.txt—all of which remain fully functional without translation assets.
Repository Components You Will Retain
When performing a sparse checkout excluding translations, the following components are preserved:
lessons/– Jupyter notebooks covering symbolic AI, neural networks, computer vision, and NLP (e.g.,lessons/3-NeuralNetworks/03-Perceptron/Perceptron.ipynb)examples/– Standalone Python scripts for quick experimentation (e.g.,examples/01-hello-ai-world.py,examples/02-simple-neural-network.py)etc/quiz-app/– Vue.js-based interactive quiz application (etc/quiz-app/src/App.vue)environment.yml– Conda environment definition including PyTorch, OpenCV, NumPy, and scikit-learnrequirements.txt– Pip-compatible dependency list.devcontainer/– VS Code development container configurationbinder/– Configuration for cloud-based notebook execution
Step-by-Step Sparse Checkout Instructions
Git's sparse checkout feature requires two phases: a blobless clone that skips downloading file contents initially, followed by a cone pattern definition that excludes specific directories.
Unix-like Systems (Bash, macOS, Linux)
Run these commands in your terminal:
# Initialize blobless sparse clone
git clone --filter=blob:none --sparse https://github.com/microsoft/AI-For-Beginners.git
cd AI-For-Beginners
# Checkout everything except translation directories
git sparse-checkout set --no-cone '/*' '!translations' '!translated_images'
The --filter=blob:none flag prevents Git from downloading file blobs until they are actually needed, while the --no-cone pattern syntax allows precise exclusion rules using the ! prefix.
Windows Command Prompt
For Windows CMD, use double quotes instead of single quotes:
git clone --filter=blob:none --sparse https://github.com/microsoft/AI-For-Beginners.git
cd AI-For-Beginners
git sparse-checkout set --no-cone "/*" "!translations" "!translated_images"
Both methods create a working directory containing the full curriculum structure minus the excluded translation folders.
Setting Up the Environment After Checkout
Once the sparse checkout completes, configure the Python environment using the preserved configuration files.
Create and activate the Conda environment:
conda env create -f environment.yml
conda activate ai4beg
Verify installation:
python -c "import torch, cv2, numpy; print('PyTorch, OpenCV, and NumPy loaded successfully')"
Launch a lesson notebook:
jupyter notebook lessons/3-NeuralNetworks/03-Perceptron/Perceptron.ipynb
Alternatively, run the example scripts directly to verify the installation:
python examples/01-hello-ai-world.py
python examples/02-simple-neural-network.py
These scripts test fundamental AI concepts including pattern recognition and neural network basics, confirming that the core curriculum operates correctly without translation assets.
Summary
- Sparse git checkout allows you to clone microsoft/AI-For-Beginners without the
translations/andtranslated_images/directories, reducing repository size from hundreds of megabytes to a few dozen megabytes. - Use
git clone --filter=blob:none --sparsecombined withgit sparse-checkout set --no-cone '/*' '!translations' '!translated_images'to exclude localization assets. - The retained repository includes all Jupyter notebooks in
lessons/, example scripts inexamples/, the quiz application inetc/quiz-app/, and dependency filesenvironment.ymlandrequirements.txt. - After checkout, create the Conda environment using
environment.ymland activate theai4begenvironment to run lessons locally.
Frequently Asked Questions
What is the difference between sparse checkout and partial clone?
Sparse checkout controls which directories appear in your working tree, while partial clone (specifically --filter=blob:none) controls which objects Git downloads from the remote. When used together—as in the AI for Beginners workflow—you get both a filtered working directory and reduced network transfer, since Git only fetches file contents when you actually checkout specific paths.
Can I add the translations back later if I need them?
Yes. Run git sparse-checkout set --no-cone '/*' without the exclusion patterns, then execute git checkout to populate the previously excluded translations/ and translated_images/ directories. Git will download the missing blobs on demand.
Does sparse checkout affect the Git history or commit functionality?
No. The repository history remains complete; you are simply choosing which files populate your working directory. You can commit, branch, and interact with the repository normally. Files outside your sparse-checkout pattern exist in the Git database but remain absent from your filesystem until explicitly included.
Which method uses less bandwidth: sparse checkout or downloading the full repository?
Sparse checkout with --filter=blob:none uses significantly less bandwidth for the initial clone because it skips downloading the content of all files initially, then avoids fetching the translation blobs entirely. This is optimal for the AI for Beginners curriculum, where translation assets constitute the majority of the repository size but are unnecessary for English-language learners.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →