TensorFlow and PyTorch Versions Used in the AI for Beginners Curriculum

The Microsoft AI for Beginners curriculum pins TensorFlow 2.17.0 and PyTorch 2.12.1 in its dependency files to guarantee reproducible environments across all machine learning lessons.

The open-source curriculum at microsoft/AI-For-Beginners teaches deep learning concepts using both TensorFlow and PyTorch. To ensure compatibility with the provided notebooks and prevent API-breaking changes, the repository explicitly declares exact framework versions in its requirement files and Conda environment configuration.

Exact Framework Versions

The curriculum locks specific releases of both frameworks to maintain stability throughout the learning modules.

TensorFlow 2.17.0

The global dependency file requirements.txt specifies TensorFlow 2.17.0 on line 16. This file serves as the primary source for pip installations across the entire curriculum, ensuring that all TensorFlow-based lessons—from basic neural networks to convolutional architectures—use identical API behaviors.

PyTorch 2.12.1

For the Natural Language Processing modules, the lesson-specific file lessons/5-NLP/requirements-pytorch.txt pins PyTorch 2.12.1 on line 10. This targeted approach allows the NLP lessons to maintain specific compatibility requirements while other modules may rely on the base environment.

Environment Configuration Strategy

The repository uses a hybrid dependency management approach to balance flexibility with reproducibility.

The environment.yml file defines the base Conda environment, pulling PyTorch from the pytorch channel. However, the lesson-level requirements-pytorch.txt overrides this by explicitly specifying torch == 2.12.1, ensuring the exact version takes precedence during installation. TensorFlow is installed via pip as specified in requirements.txt, bypassing Conda's package manager for this specific dependency.

This dual-file strategy ensures that learners installing via pip install -r requirements.txt receive TensorFlow 2.17.0, while those working through the NLP lessons can additionally install the specific PyTorch build required for transformer models and text processing examples.

Verifying Your Installation

Run these commands in your Python environment to confirm you have the versions matching the curriculum's source code:

import tensorflow as tf
print("TensorFlow version:", tf.__version__)

# Expected output: 2.17.0
import torch
print("PyTorch version:", torch.__version__)

# Expected output: 2.12.1

If your output matches the versions declared in requirements.txt and lessons/5-NLP/requirements-pytorch.txt, your environment aligns with the tested configurations used in the lesson notebooks.

Summary

  • The curriculum uses TensorFlow 2.17.0, declared in the root requirements.txt at line 16.
  • PyTorch 2.12.1 is required for NLP lessons, specified in lessons/5-NLP/requirements-pytorch.txt at line 10.
  • The environment.yml Conda configuration works in conjunction with pip requirements to create a reproducible environment.
  • Verifying installations with tf.__version__ and torch.__version__ ensures compatibility with the provided CNN and Transformer examples.

Frequently Asked Questions

What TensorFlow version is required for the AI for Beginners course?

The course requires TensorFlow 2.17.0, which is listed in the main requirements.txt file. This version ensures compatibility with all computer vision and neural network lessons throughout the curriculum.

Why does the NLP module use a different PyTorch version file?

The NLP lessons specifically require PyTorch 2.12.1 as defined in lessons/5-NLP/requirements-pytorch.txt. This lesson-specific pinning ensures that transformer models and text processing scripts function correctly with the exact API signatures taught in those modules.

How do I install the correct framework versions for the curriculum?

Install TensorFlow 2.17.0 by running pip install -r requirements.txt from the repository root. For the NLP lessons, additionally run pip install -r lessons/5-NLP/requirements-pytorch.txt to install PyTorch 2.12.1 and its dependencies.

Will newer versions of TensorFlow or PyTorch work with the curriculum?

While newer versions might function, the curriculum is tested exclusively with TensorFlow 2.17.0 and PyTorch 2.12.1. Using different versions may result in deprecation warnings or errors, particularly in lessons utilizing specific Keras APIs or PyTorch transformer implementations.

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:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →