{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 🧠 NeuralAI Phase 3: TPU v5e-1 DPO Alignment\n", "\n", "This notebook is optimized for training the NeuralAI model using **TPU v5e-1** on Google Colab. It performs **Direct Preference Optimization (DPO)** to align the model's responses with human preferences.\n", "\n", "### 🚀 Setup Instructions\n", "1. Go to **Runtime > Change runtime type**.\n", "2. Select **TPU** as the hardware accelerator.\n", "3. Select **v5e-1** as the TPU type.\n", "4. Click **Save**." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# 1. Install Dependencies\n", "!pip install -q transformers peft trl datasets accelerate\n", "# Updated for Python 3.12 and TPU v5e compatibility\n", "!pip install torch torch_xla[tpu] -f https://storage.googleapis.com/libtpu-releases/index.html\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# 2. Clone Repository (if needed) or Setup Workspace\n", "!git clone https://github.com/Subject-Emu-5259/NeuralAI-from-scratch.git\n", "%cd NeuralAI-from-scratch" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# 3. Run TPU Training\n", "!python3 training/train_dpo_tpu.py" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### ✅ Next Steps\n", "Once training is complete, the fine-tuned model will be saved in `checkpoints/dpo_tpu_model`. You can download it or push it back to GitHub." ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.12" } }, "nbformat": 4, "nbformat_minor": 2 }