Git & GitHub
Version control — the foundation of every software project
Why Git?
Every AI project involves experiments — different model architectures, hyperparameters, datasets. Git lets you track every change, revert mistakes, and collaborate with others. It's non-negotiable in professional AI work.
Install Git
macOS
brew install git
Don't have Homebrew? Run: /bin/bash -c "$(curl -fsSL https://brew.sh/install.sh)"
Windows
Download from git-scm.com and run the installer. Use all defaults.
Ubuntu/Debian
sudo apt update && sudo apt install git
Configure Git
git config --global user.name "Your Name" git config --global user.email "you@example.com" git config --global init.defaultBranch main
Essential Commands
# Start a new project git init my-ai-project cd my-ai-project # Track changes git add . git commit -m "Initial commit" # Connect to GitHub git remote add origin https://github.com/yourusername/my-ai-project.git git push -u origin main # Clone an existing project git clone https://github.com/huggingface/transformers.git
Pro tip
Create a .gitignore file to exclude large model files and datasets. Add *.pt, *.bin, data/, and .env to it.
Python Setup
The language of AI — install it right the first time
Install Python via pyenv (recommended)
pyenv lets you manage multiple Python versions — essential when different AI projects need different versions.
# macOS / Linux curl https://pyenv.run | bash # Add to your shell (~/.zshrc or ~/.bashrc) export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" eval "$(pyenv init -)" # Install Python 3.11 (best for AI in 2025) pyenv install 3.11.9 pyenv global 3.11.9 python --version # Should show 3.11.9
Windows users: download Python 3.11 from python.org and check "Add to PATH".
Virtual Environments
Always use a virtual environment. It isolates your project's packages from the system Python.
# Create a virtual environment python -m venv .venv # Activate it source .venv/bin/activate # macOS/Linux .venv\Scripts\activate # Windows # Your prompt will show (.venv) # Install packages pip install numpy pandas scikit-learn # Save dependencies pip freeze > requirements.txt # Deactivate when done deactivate
Core AI Packages
pip install numpy pandas matplotlib scikit-learn pip install torch torchvision # PyTorch pip install transformers datasets # HuggingFace pip install jupyter ipykernel # Notebooks
Common mistake
Never pip install without activating your virtual environment first. You'll pollute your system Python and cause version conflicts.
Dev Tools
VS Code, Jupyter, and the AI developer's toolkit
VS Code — Your Primary Editor
Download from code.visualstudio.com. Then install these essential extensions:
Python
by Microsoft — linting, debugging, IntelliSense
Jupyter
Run notebooks directly in VS Code
GitHub Copilot
AI pair programmer — free for students
Pylance
Fast type checking and autocomplete
# Open VS Code from terminal code . # Select Python interpreter (Ctrl+Shift+P) # > Python: Select Interpreter # Choose your .venv
Jupyter Notebooks
Notebooks let you run code cell by cell — perfect for exploring data and experimenting with models.
# Start Jupyter in your project folder jupyter notebook # Or use JupyterLab (better UI) pip install jupyterlab jupyter lab
Terminal Setup
# macOS: use iTerm2 + zsh (already default on macOS) # Windows: use Windows Terminal + WSL2 for Linux environment # Useful aliases to add to ~/.zshrc or ~/.bashrc alias jl="jupyter lab" alias activate="source .venv/bin/activate" alias gs="git status"
Your First AI Script
Build a working sentiment classifier in 30 minutes
What you'll build
A sentiment classifier that reads a sentence and tells you if it's positive or negative. You'll use a pre-trained HuggingFace model — no training required.
Step 1 — Create your project
mkdir my-first-ai && cd my-first-ai git init python -m venv .venv source .venv/bin/activate # Windows: .venv\Scripts\activate pip install transformers torch
Step 2 — Write the script
Create a file called sentiment.py:
from transformers import pipeline
# Load a pre-trained sentiment model (downloads ~250MB first time)
classifier = pipeline("sentiment-analysis")
# Test it
sentences = [
"I love learning about AI, it's fascinating!",
"This is really frustrating and confusing.",
"The model performance was acceptable.",
]
for sentence in sentences:
result = classifier(sentence)[0]
label = result['label']
score = result['score']
emoji = "😊" if label == "POSITIVE" else "😞"
print(f"{emoji} [{label} {score:.2f}] {sentence}")
Step 3 — Run it
python sentiment.py
😊 [POSITIVE 0.99] I love learning about AI, it's fascinating!
😞 [NEGATIVE 0.99] This is really frustrating and confusing.
😊 [POSITIVE 0.72] The model performance was acceptable.
Step 4 — Save your work with Git
echo ".venv/" > .gitignore echo "__pycache__/" >> .gitignore git add sentiment.py .gitignore git commit -m "feat: first AI sentiment classifier"
🎉 You just ran your first AI model!
You used a transformer model (DistilBERT) trained on millions of reviews. It runs entirely on your machine with no API calls. This is the same architecture behind ChatGPT — just smaller.