{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# šŸš€ VIBE CODER v2.0 MAX — Official Google Colab Studio\n", "\n", "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/shawaz03/LLM/blob/main/vibe_coder_quickstart.ipynb)\n", "\n", "Run **Vibe Coder v2.0 MAX (7B)** on a **Free Google Colab T4 GPU** in 4-bit NF4 Quantization (5.2 GB VRAM, 0 memory errors).\n", "\n", "- **Hugging Face Model**: [`shawaz03/vibe-coder-7b-max`](https://huggingface.co/shawaz03/vibe-coder-7b-max)\n", "- **Specialization**: Autonomous Full-Stack React 19, Next.js 15, TypeScript, Tailwind CSS, Prisma, and Anti-AI Aesthetic Directives." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 1. Install Dependencies" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "!pip install -q transformers torch accelerate bitsandbytes huggingface_hub" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 2. Load Model in 4-bit (Fast & Zero Memory Overhead)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import torch\n", "from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig, TextStreamer\n", "\n", "MODEL_ID = \"shawaz03/vibe-coder-7b-max\"\n", "print(f\"šŸš€ Loading {MODEL_ID} in 4-bit NF4...\")\n", "\n", "bnb_config = BitsAndBytesConfig(\n", " load_in_4bit=True,\n", " bnb_4bit_quant_type=\"nf4\",\n", " bnb_4bit_use_double_quant=True,\n", " bnb_4bit_compute_dtype=torch.float16,\n", ")\n", "\n", "tokenizer = AutoTokenizer.from_pretrained(MODEL_ID, trust_remote_code=True)\n", "model = AutoModelForCausalLM.from_pretrained(\n", " MODEL_ID,\n", " quantization_config=bnb_config,\n", " device_map=\"auto\",\n", " trust_remote_code=True,\n", ")\n", "model.eval()\n", "streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)\n", "\n", "print(\"\\nāœ… VIBE CODER IS READY!\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3. Vibe Coder Engine Definition" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "VIBE_CODER_SYSTEM_PROMPT = \"\"\"You are Vibe Coder, a world-class principal full-stack software engineer and UI/UX designer.\n", "ENGINEERING & CODING DIRECTIVES:\n", "1. COMPLETE IMPLEMENTATIONS: Never output '// TODO', '/* implement later */', or incomplete stubs. Every component, hook, and route must be fully written.\n", "2. NO ARTIFACT STRINGS: Never output template tags, variant numbers (e.g. 'Build Variant #...'), or internal directive texts.\n", "3. FULL STATE & INTERACTION: Include real mock data arrays, working toggle logic, and complete TypeScript types.\n", "4. MODERN DESIGN SYSTEM: Use Tailwind CSS with dark neutral palettes (bg-neutral-900, border-neutral-800), clean accents (cyan, emerald, violet), and Lucide React icons.\n", "5. CLEAN OUTPUT: Output standard, clean TypeScript/React code with 'use client' when state is used.\"\"\"\n", "\n", "def ask_vibe_coder(prompt_text, temperature=0.2, max_tokens=1500):\n", " if not prompt_text.strip():\n", " print(\"āš ļø Please enter a prompt in the box below.\")\n", " return\n", "\n", " messages = [\n", " {\"role\": \"system\", \"content\": VIBE_CODER_SYSTEM_PROMPT},\n", " {\"role\": \"user\", \"content\": prompt_text}\n", " ]\n", " \n", " formatted_prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)\n", " inputs = tokenizer(formatted_prompt, return_tensors=\"pt\").to(\"cuda\")\n", " \n", " print(\"=\" * 75)\n", " print(f\"šŸ’¬ USER PROMPT: {prompt_text}\")\n", " print(\"=\" * 75 + \"\\n\")\n", " \n", " with torch.no_grad():\n", " model.generate(\n", " **inputs,\n", " streamer=streamer,\n", " max_new_tokens=max_tokens,\n", " temperature=temperature,\n", " top_p=0.95,\n", " repetition_penalty=1.05,\n", " do_sample=True,\n", " eos_token_id=tokenizer.eos_token_id,\n", " pad_token_id=tokenizer.pad_token_id,\n", " )\n", " print(\"\\n\" + \"=\" * 75)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 4. šŸŽ® Dynamic Prompt Studio (Interactive Form Box)\n", "Type your custom prompt into the box below and click the **Play (Run)** button:" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "cellView": "form" }, "outputs": [], "source": [ "# @title šŸš€ Vibe Coder Interactive Code Generator { vertical-output: true }\n", "# @markdown Enter your custom prompt and configure generation settings:\n", "\n", "prompt = \"Build an interactive pricing matrix in React with Tailwind CSS, supporting monthly/annual billing toggle, 5 feature bullet checkmarks, and popular badge with zero placeholders.\" # @param {type:\"string\"}\n", "temperature = 0.2 # @param {type:\"slider\", min:0.05, max:1.0, step:0.05}\n", "max_tokens = 1500 # @param {type:\"slider\", min:256, max:3072, step:128}\n", "\n", "ask_vibe_coder(prompt, temperature=temperature, max_tokens=max_tokens)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 5. šŸ’¬ Continuous Live Chat Loop\n", "Run this cell to chat and prompt continuously in real-time:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "while True:\n", " user_query = input(\"\\nšŸ‘‰ Type any prompt (or 'exit' to quit): \")\n", " if not user_query.strip() or user_query.lower() in [\"exit\", \"quit\"]:\n", " print(\"Session stopped.\")\n", " break\n", " ask_vibe_coder(user_query, temperature=0.2)" ] } ], "metadata": { "accelerator": "GPU", "colab": { "gpuType": "T4", "provenance": [] }, "language_info": { "name": "python" } }, "nbformat": 4, "nbformat_minor": 0 }