# How to Use Sparse Git Checkout to Clone the AI for Beginners Repository Without Translations

> Clone the AI For Beginners repo without translations using sparse Git checkout. Download only core curriculum, excluding 50+ language directories, saving time and disk space.

- Repository: [Microsoft/AI-For-Beginners](https://github.com/microsoft/AI-For-Beginners)
- Tags: how-to-guide
- Published: 2026-08-09

---

**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`](https://github.com/microsoft/AI-For-Beginners/blob/main/environment.yml) and [`requirements.txt`](https://github.com/microsoft/AI-For-Beginners/blob/main/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`](https://github.com/microsoft/AI-For-Beginners/blob/main/examples/01-hello-ai-world.py), [`examples/02-simple-neural-network.py`](https://github.com/microsoft/AI-For-Beginners/blob/main/examples/02-simple-neural-network.py))
- **`etc/quiz-app/`** – Vue.js-based interactive quiz application ([`etc/quiz-app/src/App.vue`](https://github.com/microsoft/AI-For-Beginners/blob/main/etc/quiz-app/src/App.vue))
- **[`environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/environment.yml)** – Conda environment definition including PyTorch, OpenCV, NumPy, and scikit-learn
- **[`requirements.txt`](https://github.com/microsoft/AI-For-Beginners/blob/main/requirements.txt)** – Pip-compatible dependency list
- **`.devcontainer/`** – VS Code development container configuration
- **`binder/`** – 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:

```bash

# 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:

```cmd
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:**

```bash
conda env create -f environment.yml
conda activate ai4beg

```

**Verify installation:**

```bash
python -c "import torch, cv2, numpy; print('PyTorch, OpenCV, and NumPy loaded successfully')"

```

**Launch a lesson notebook:**

```bash
jupyter notebook lessons/3-NeuralNetworks/03-Perceptron/Perceptron.ipynb

```

Alternatively, run the example scripts directly to verify the installation:

```bash
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/` and `translated_images/` directories, reducing repository size from hundreds of megabytes to a few dozen megabytes.
- Use `git clone --filter=blob:none --sparse` combined with `git sparse-checkout set --no-cone '/*' '!translations' '!translated_images'` to exclude localization assets.
- The retained repository includes all Jupyter notebooks in `lessons/`, example scripts in `examples/`, the quiz application in `etc/quiz-app/`, and dependency files [`environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/environment.yml) and [`requirements.txt`](https://github.com/microsoft/AI-For-Beginners/blob/main/requirements.txt).
- After checkout, create the Conda environment using [`environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/environment.yml) and activate the `ai4beg` environment 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.