Title: Lab 4 — Environment, Install, and Your First Container
Course: AIINFRA 100: AI Systems & Development Environments > Section: Week 04 — The AI Software Stack: Frameworks, CUDA, Drivers, Model Formats

🛠️ Lab 4 — Environment, Install, and Your First Container (50 pts)

Goal: Get hands-on with the full software stack from this week's lecture — isolate a Python environment, install PyTorch the correct way, load a real pretrained model in safetensors format, and package it all into a Docker container — using only free tools. Steps:

1. Set up your workspace. You may do this lab entirely in a free Google Colab notebook, or on your own computer if you already have Python 3.11+ and Docker Desktop (free tier) installed. Either is acceptable — note which one you used in your submission.
2. Create and activate an isolated environment. If working locally, open a terminal and run python -m venv ai-lab-env, then activate it (source ai-lab-env/bin/activate on Mac/Linux, or ai-lab-env\Scripts\activate on Windows). Take a screenshot showing your terminal prompt has changed to show the environment is active. (If using Colab, skip this step and note in your writeup that Colab provides its own managed environment.)
3. Install PyTorch the correct way. Go to the official PyTorch install selector (link in Resources), select your OS, choose Pip as the package manager, and choose CPU as the compute platform (no need for a GPU for this lab). Copy the exact command it gives you and run it in your activated environment (or a Colab cell). Take a screenshot of the successful install.
4. Load a small pretrained model and inspect it. In a new Python file or Colab cell, write a short script (about 5 lines) that uses the Hugging Face transformers library to load a small pretrained model saved in safetensors format (for example, distilbert-base-uncased) and prints its total parameter count. Include the exact code and its output in your submission.
5. Write a minimal Dockerfile. Create a file named Dockerfile (no extension) containing: a FROM python:3.11-slim base image line, a line to pip install torch (and transformers if needed for your script), and a COPY line that copies your script into the image. Include the full contents of your Dockerfile in your submission.
6. Build and run your container. If you have Docker Desktop installed locally, run docker build -t ai-lab-image . and then docker run ai-lab-image and confirm your script's output appears. Take a screenshot of the successful build and run. (If you only used Colab and do not have Docker locally, write your Dockerfile as instructed in Step 5 and explain in one paragraph what you expect would happen when it's built and run — partial credit is available for this option.)

Deliverables: Submit one document (PDF or text) containing: your environment/install screenshots, your 5-line model-loading script and its printed output, your full Dockerfile contents, your build/run screenshot (or written explanation if Docker wasn't available to you), and a short note on which workspace option you used.