Title: Lab 2 — Toolchain Setup and Open Model License Audit
Course: AIINFRA 201: Model Adaptation — Fine-Tuning & Quantization > Section: Week 02 — Open Models, Licenses, and the Fine-Tuning Toolchain Setup

🛠️ Lab 2 — Toolchain Setup and Open Model License Audit (50 pts)

Goal: Install the complete 2026 fine-tuning toolchain in a free Google Colab notebook, verify your environment by loading a small open model and running a forward pass, then audit five candidate open models on the Hugging Face Hub for license fitness in a hypothetical commercial deployment. Steps:

1. Open a new notebook at colab.research.google.com and set the runtime to a free GPU (Runtime → Change runtime type → T4 GPU).
2. In the first cell, install the toolchain: pip install -U transformers peft trl bitsandbytes accelerate datasets.
3. Run import torch; print(torch.cuda.is_available(), torch.cuda.get_device_name(0)) and confirm your notebook detects a GPU. Paste this output into your submission.
4. Load a small open model with from_pretrained — use either Qwen/Qwen2.5-0.5B-Instruct or an equivalent small SmolLM2 checkpoint from Hugging Face. Load both the tokenizer and the model.
5. Tokenize a short test prompt (e.g., "Explain fine-tuning in one sentence.") and run a forward pass through the model. Confirm you get output back with no errors, and print the output shape or generated text as proof.
6. Browse the Hugging Face Hub (huggingface.co/models) and use the license filter in the left sidebar to identify candidate models. Select 5 open models suitable for a hypothetical commercial chatbot deployment (include at least Qwen 3, one Llama version, one Mistral model, and two of your choosing).
7. For each model, open its model card on Hugging Face and record: the exact license name, whether it is OSI-approved, any usage caps or field-of-use restrictions, and whether you would greenlight it for commercial fine-tuning and deployment. Flag any clause that could block a "serve the model via our own API" business model.
8. Build a comparison table (markdown or spreadsheet) with columns: Model \| License \| OSI-Approved? \| Usage Cap/Restrictions \| Commercial-Deployment Verdict.
9. Write 3–4 sentences summarizing which model you'd choose for the hypothetical deployment and why, citing the specific license clause that drove your decision.

Deliverables: Submit your Colab notebook (.ipynb, shared link or file upload) showing the GPU check and successful forward pass, plus your 5-model license comparison table with the written summary, either as a section in the notebook or a separate document upload.