AI Frameworks and Libraries Used in Microsoft's AI For Beginners
Microsoft's AI For Beginners curriculum depends on TensorFlow 2.17.0, PyTorch, Keras 3.13.2, OpenCV, Hugging Face utilities, and scikit-learn, with all packages declared in requirements.txt and environment.yml.
The microsoft/AI-For-Beginners repository is a comprehensive learning path that covers symbolic AI, neural networks, computer vision, and natural language processing. Its AI frameworks and libraries are explicitly pinned in requirements.txt and environment.yml at the repository root, ensuring a consistent, cross-platform environment that runs locally, in dev containers, or on cloud platforms like Azure ML and Google Colab.
Core Deep Learning Frameworks
The curriculum centers on three major neural-network engines. Each is referenced in the dependency files and used throughout the lesson notebooks.
TensorFlow and Keras
TensorFlow 2.17.0 serves as the primary full-stack machine learning library for building and training neural networks. The repository also pins Keras 3.13.2, which operates as a high-level API on top of TensorFlow. Together they power lessons on perceptrons, CNNs, and transformers.
In requirements.txt, TensorFlow is listed as a core dependency, while Keras provides the simplified interface used in introductory examples. For instance, the sentiment-analysis script examples/04-text-sentiment.py loads the IMDB dataset through Keras and compiles a Sequential model with Embedding, Conv1D, and Dense layers:
from keras.datasets import imdb
from keras.preprocessing import sequence
from keras import layers, models
max_features = 10000
maxlen = 200
(x_train, y_train), (x_test, y_test) = imdb.load_data(num_words=max_features)
x_train = sequence.pad_sequences(x_train, maxlen=maxlen)
x_test = sequence.pad_sequences(x_test, maxlen=maxlen)
model = models.Sequential([
layers.Embedding(max_features, 128),
layers.Conv1D(32, 7, activation='relu'),
layers.GlobalMaxPooling1D(),
layers.Dense(1, activation='sigmoid')
])
model.compile(optimizer='adam',
loss='binary_crossentropy',
metrics=['accuracy'])
model.fit(x_train, y_train,
epochs=3,
batch_size=128,
validation_split=0.2)
PyTorch
PyTorch is installed via the pytorch::pytorch Conda channel as specified in environment.yml. Its dynamic computation graph makes it ideal for research-oriented lessons and prototyping. The repository uses PyTorch alongside torchvision for computer-vision modules and torchtext for NLP preprocessing.
The notebook lessons/4-ComputerVision/07-ConvNets/ConvNetsPyTorch.ipynb demonstrates a convolutional neural net built with torch.nn and trained on MNIST through torchvision.datasets:
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision import datasets, transforms
class SimpleCNN(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(1, 32, 3, 1)
self.fc1 = nn.Linear(32 * 26 * 26, 10)
def forward(self, x):
x = F.relu(self.conv1(x))
x = x.view(-1, 32 * 26 * 26)
x = self.fc1(x)
return F.log_softmax(x, dim=1)
# Load MNIST
transform = transforms.Compose([transforms.ToTensor()])
mnist = datasets.MNIST('.', download=True, transform=transform)
loader = torch.utils.data.DataLoader(mnist, batch_size=64, shuffle=True)
model = SimpleCNN()
optimizer = torch.optim.Adam(model.parameters())
criterion = nn.NLLLoss()
for epoch in range(2):
for data, target in loader:
optimizer.zero_grad()
output = model(data)
loss = criterion(output, target)
loss.backward()
optimizer.step()
Computer Vision and Image Processing Libraries
The computer-vision modules rely on a layered stack of imaging tools. OpenCV (from conda-forge), imageio, and scikit-image handle image I/O and classic algorithms, while torchvision supplies PyTorch-specific datasets and transforms.
These libraries appear in notebooks like examples/03-image-classifier.ipynb, which demonstrates end-to-end image classification using TensorFlow, torchvision, and OpenCV together.
Natural Language Processing Utilities
The NLP lessons leverage both modern transformer tooling and classical text-processing libraries. Key dependencies include:
- huggingface – utilities for transformer models
- tokenizers – fast tokenization pipelines
- torchtext – text datasets and preprocessing for PyTorch
- tensorflow-datasets and tensorflow-hub – ready-made datasets and pretrained models for TensorFlow
- nltk – classic NLP algorithms
These packages support lessons on sentiment analysis, word embeddings, and transformer basics. They are declared in requirements.txt alongside the deep-learning frameworks.
Reinforcement Learning and Simulation Tools
The reinforcement-learning sections use gym 0.26.2 to provide standard RL environment APIs, while pygame enables simple graphics for custom grid-world and mountain-car examples.
A minimal training loop with the gym library looks like this:
import gym
env = gym.make('CartPole-v1')
obs = env.reset()
for _ in range(200):
env.render()
action = env.action_space.sample() # random policy
obs, reward, done, info = env.step(action)
if done:
break
env.close()
General-Purpose Machine Learning and Visualization Utilities
Underpinning every module is a set of general-purpose Python libraries for data manipulation, classical ML, and visualization. According to the source files, these include:
- NumPy, pandas, and SciPy – numerical computing and data handling
- scikit-learn – classical machine learning algorithms
- matplotlib and seaborn – plotting and visualization
- tqdm – progress bars for long-running training loops
- tensorboard and tensorboard-data-server – real-time training monitoring
- smart-open, gensim, and torchinfo – auxiliary utilities for model introspection
Environment Setup
All AI frameworks and libraries are declared in two files at the repository root. The requirements.txt file contains the pip-based package list, while environment.yml defines the Conda environment and references requirements.txt via the -r directive. You can install the full curriculum stack with either:
pip install -r requirements.txt
Or, using Conda:
conda env create -f environment.yml
Summary
- Microsoft's AI For Beginners is built around TensorFlow 2.17.0, PyTorch, and Keras 3.13.2, with dependencies pinned in
requirements.txtandenvironment.yml. - Computer vision lessons use OpenCV, scikit-image, and torchvision, while NLP lessons rely on Hugging Face tools, NLTK, and torchtext.
- Reinforcement learning examples run on
gym 0.26.2and pygame. - General-purpose libraries such as NumPy, pandas, scikit-learn, and matplotlib provide data handling, classical ML, and visualization support across all modules.
Frequently Asked Questions
Does AI For Beginners require both TensorFlow and PyTorch?
Yes. The curriculum teaches lessons using both frameworks, and requirements.txt together with environment.yml install TensorFlow 2.17.0, Keras 3.13.2, and PyTorch. Some notebooks, such as lessons/4-ComputerVision/07-ConvNets/ConvNetsPyTorch.ipynb, use PyTorch exclusively, while others use TensorFlow.
Can I run the AI For Beginners notebooks without a GPU?
Absolutely. All AI frameworks and libraries in the repository are CPU-compatible by default. Both requirements.txt and environment.yml install standard PyPI and Conda packages that run on standard hardware, making the curriculum accessible on laptops, dev containers, or cloud notebooks like Google Colab.
Where are the NLP libraries used in the repository?
Natural language processing utilities are exercised in several lesson notebooks and scripts. For example, examples/04-text-sentiment.py uses Keras with TensorFlow to perform IMDB sentiment classification, while other modules import nltk, torchtext, and Hugging Face tokenizers for text preprocessing and transformer basics.
How does the repository keep its AI frameworks and libraries synchronized?
The project maintains a single source of truth in requirements.txt, which lists every pip package. The Conda environment file environment.yml references this list with the -r requirements.txt directive and adds the pytorch channel for PyTorch binaries. This structure ensures that local pip installs and Conda environments stay consistent.
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 →