What you are installing

Anaconda
Python + package manager. Install this first — it replaces a bare Python install.
VS Code
Code editor. Where you write Python, open notebooks, and browse the repo.
Git
Version control. How you submit work and sync with the lab repo.
Ollama
Runs LLMs locally (Gemma3:4B). Required for Week 1 pipeline run.

Mac Installation

Step 1 — Install Anaconda

Anaconda gives you Python 3.11 + conda package manager + Jupyter all at once. Do not install bare Python separately — it causes conflicts.

  1. Go to anaconda.com/download
  2. Download the macOS graphical installer (choose Apple Silicon / M1/M2/M3 if your Mac is 2020 or newer; Intel otherwise)
  3. Open the .pkg file and follow the installer — click through all defaults
  4. When the installer finishes, open a new Terminal (Cmd+Space → type "Terminal")
  5. Verify: conda --version should print a version number
conda --version
# Expected: conda 24.x.x or similar

Step 2 — Create the lab environment

This creates an isolated Python environment called compliancegpt. All packages go here — nothing pollutes your system Python.

conda create -n compliancegpt python=3.11 -y
conda activate compliancegpt

You should see (compliancegpt) appear at the start of your terminal prompt. Run conda activate compliancegpt every time you open a new terminal for this project.

Step 3 — Install packages

pip install pandas numpy matplotlib seaborn scikit-learn \
            jupyter ipykernel \
            transformers datasets tokenizers huggingface_hub \
            peft bitsandbytes accelerate trl \
            tiktoken requests httpx ollama

This takes 3–5 minutes. If you see any red error lines, copy them and post in Slack.

Step 4 — Install VS Code

  1. Go to code.visualstudio.com and download the Mac version
  2. Drag VS Code to your Applications folder
  3. Open VS Code → press Cmd+Shift+X → search Python → install the Microsoft Python extension
  4. Also install: Jupyter extension (search "Jupyter" in extensions)
  5. Press Cmd+Shift+P → type "Python: Select Interpreter" → choose compliancegpt

Step 5 — Install Git

Mac may already have Git. Check first:

git --version

If it prints a version — you're done. If not, install via Homebrew:

# Install Homebrew first if you don't have it:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# Then install git:
brew install git

Then configure your identity (use your real name and university email):

git config --global user.name "Your Name"
git config --global user.email "you@university.edu"

Step 6 — Install Ollama

  1. Go to ollama.com → click Download → download the Mac version
  2. Open the .dmg and drag Ollama to Applications
  3. Open Ollama from Applications — it runs as a menu bar icon
  4. In Terminal, pull Gemma3:4B (3–5 min download):
ollama pull gemma3:4b

Test it:

ollama run gemma3:4b "What is HIPAA?"
# Should print a short answer. Type /bye to exit.

Mac — Verification

Run all of these in Terminal with (compliancegpt) active. Every line should succeed:

python --version          # Python 3.11.x
conda activate compliancegpt
python -c "import pandas; print(pandas.__version__)"
python -c "import transformers; print(transformers.__version__)"
python -c "import peft; print(peft.__version__)"
git --version
ollama list               # should show gemma3:4b

After Installation — Clone the Repo & Run the Pipeline

These steps are the same on Mac and Windows. Run them in Terminal (Mac) or Anaconda Prompt (Windows) with (compliancegpt) active.

Step 7 — Clone the lab repository

git clone https://github.com/priscilla100/COMPLIANCEGPT.git
cd COMPLIANCEGPT

If you don't have access yet, you'll receive an invite link on Slack. Accept it, then clone.

Step 8 — Install from requirements.txt

pip install -r requirements.txt

This installs exact pinned versions to ensure reproducibility. If any package fails, install the rest first and post the error in Slack.

Step 9 — Run your first experiment

# Make sure Ollama is running first (open Ollama app / check system tray)
python app/batch_runner.py \
  --input data/goldcoin_hhs_merged.csv \
  --question-col query \
  --strategy formal \
  --model ollama/gemma3:4b \
  --output results/my_first_run.csv \
  --limit 3

If you see 3 rows with PERMITTED or DENIED verdicts — you are set up correctly.

Step 10 — Open the starter notebook

jupyter notebook notebooks/week1_python.ipynb

This opens in your browser. Run the first cell — if it prints "Setup complete", you're ready for Week 1.

Slurm Server Access

Server access is handled by the program — you don't set this up yourself

You will receive SSH credentials from the program coordinator. Once you have them, connect as follows.

Connecting via SSH

Mac / Linux: open Terminal and run:

ssh yournetid@[server-address]
# Enter your password when prompted

Windows: open Git Bash (not Anaconda Prompt) and run the same command. Alternatively, install PuTTY as a GUI SSH client.

Running a job on the cluster

The server uses Slurm for job scheduling. You do not run Python directly — you submit a job script.

# Example job script: save as run_experiment.sh
#!/bin/bash
#SBATCH --job-name=compliancegpt
#SBATCH --output=logs/%j.out
#SBATCH --error=logs/%j.err
#SBATCH --time=02:00:00
#SBATCH --gres=gpu:1
#SBATCH --mem=16G

conda activate compliancegpt
python app/batch_runner.py \
  --input data/goldcoin_hhs_merged.csv \
  --strategy formal \
  --model ollama/gemma3:4b \
  --output results/server_run.csv
# Submit it:
sbatch run_experiment.sh

# Check status:
squeue --me

# View output when done:
cat logs/[job-id].out

You will walk through this together with Priscilla. Do not submit jobs before the session — you may queue jobs that conflict with others.

requirements.txt

This file lives in the root of the repository. It pins exact versions so every student's environment is identical. For reference:

# ── Core data science ──────────────────────────────────────────
pandas>=2.1.0
numpy>=1.26.0
matplotlib>=3.8.0
seaborn>=0.13.0
scikit-learn>=1.4.0

# ── Jupyter ──────────────────────────────────────────────────
jupyter>=1.0.0
ipykernel>=6.29.0
nbformat>=5.9.0

# ── HuggingFace ecosystem ────────────────────────────────────
transformers>=4.40.0
datasets>=2.19.0
tokenizers>=0.19.0
huggingface_hub>=0.22.0

# ── Parameter-efficient fine-tuning (P6) ────────────────────
peft>=0.10.0
bitsandbytes>=0.43.0
accelerate>=0.28.0
trl>=0.8.6

# ── Tokenization / utilities ─────────────────────────────────
tiktoken>=0.6.0
nltk>=3.8.0

# ── HTTP / API ────────────────────────────────────────────────
requests>=2.31.0
httpx>=0.27.0

# ── Ollama Python client ──────────────────────────────────────
ollama>=0.2.0

Final Checklist

Before the installation session ends, confirm every item:

  • conda activate compliancegpt — prompt shows (compliancegpt)
  • python --version → 3.11.x
  • import pandas, transformers, peft — no errors
  • ☐ VS Code opens, Python extension installed, interpreter set to compliancegpt
  • git --version works, name and email configured
  • ollama list shows gemma3:4b
  • git clone of the lab repo succeeded
  • pip install -r requirements.txt completed with no fatal errors
  • batch_runner.py --limit 3 produced a CSV with verdicts
  • notebooks/week1_python.ipynb opened in browser and first cell ran
  • ☐ SSH login to the Slurm server works

If any item is unchecked at the end of the session, post specifically what failed in Slack before Thursday. Include the full error message.

Python Resources

You don't need to be a Python expert. You need to be functional: load a CSV, loop over rows, call a function, save results. Here are the fastest paths to get there.

New to Python

  • CS50P (Harvard, free on edX) — Weeks 0–4. Each problem set is 2–3 hours. Best structured intro.
  • Python Crash Course — Matthes. Chapters 1–6. Available at most libraries.

Know basics, need data skills

  • Corey Schafer — Pandas series (YouTube, 10 videos). Exactly what you need for CSV analysis.
  • Automate the Boring Stuff — free at automatetheboringstuff.com. Chapters on file I/O and CSV.

The 5 patterns you use all summer

import pandas as pd, json

# 1. Load results
df = pd.read_csv("results/my_run.csv")

# 2. Find wrong predictions
wrong = df[df["verdict_norm"] != df["ground_truth"]]

# 3. Inspect extraction JSON
row = wrong.iloc[0]
sj  = json.loads(row["scenario_json"])
print(sj["sender_role"], sj["has_court_order"])

# 4. Compute accuracy
accuracy = (df["verdict_norm"] == df["ground_truth"]).mean()
print(f"Accuracy: {accuracy:.1%}")

# 5. Save annotated output
df.to_csv("results/annotated.csv", index=False)