CoolFace
Modelpublic

shawaz03/vibe-coder-7b-max

sourceHugging Faceapache-2.0updated 1mo agoView on Hugging Face
1likes189downloads
vibe_coder_quickstart.ipynb187 linesDownload Raw Back to root
1{2 "cells": [3  {4   "cell_type": "markdown",5   "metadata": {},6   "source": [7    "# ๐Ÿš€ VIBE CODER v2.0 MAX โ€” Official Google Colab Studio\n",8    "\n",9    "[![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",10    "\n",11    "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",12    "\n",13    "- **Hugging Face Model**: [`shawaz03/vibe-coder-7b-max`](https://huggingface.co/shawaz03/vibe-coder-7b-max)\n",14    "- **Specialization**: Autonomous Full-Stack React 19, Next.js 15, TypeScript, Tailwind CSS, Prisma, and Anti-AI Aesthetic Directives."15   ]16  },17  {18   "cell_type": "markdown",19   "metadata": {},20   "source": [21    "### 1. Install Dependencies"22   ]23  },24  {25   "cell_type": "code",26   "execution_count": null,27   "metadata": {},28   "outputs": [],29   "source": [30    "!pip install -q transformers torch accelerate bitsandbytes huggingface_hub"31   ]32  },33  {34   "cell_type": "markdown",35   "metadata": {},36   "source": [37    "### 2. Load Model in 4-bit (Fast & Zero Memory Overhead)"38   ]39  },40  {41   "cell_type": "code",42   "execution_count": null,43   "metadata": {},44   "outputs": [],45   "source": [46    "import torch\n",47    "from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig, TextStreamer\n",48    "\n",49    "MODEL_ID = \"shawaz03/vibe-coder-7b-max\"\n",50    "print(f\"๐Ÿš€ Loading {MODEL_ID} in 4-bit NF4...\")\n",51    "\n",52    "bnb_config = BitsAndBytesConfig(\n",53    "    load_in_4bit=True,\n",54    "    bnb_4bit_quant_type=\"nf4\",\n",55    "    bnb_4bit_use_double_quant=True,\n",56    "    bnb_4bit_compute_dtype=torch.float16,\n",57    ")\n",58    "\n",59    "tokenizer = AutoTokenizer.from_pretrained(MODEL_ID, trust_remote_code=True)\n",60    "model = AutoModelForCausalLM.from_pretrained(\n",61    "    MODEL_ID,\n",62    "    quantization_config=bnb_config,\n",63    "    device_map=\"auto\",\n",64    "    trust_remote_code=True,\n",65    ")\n",66    "model.eval()\n",67    "streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)\n",68    "\n",69    "print(\"\\nโœ… VIBE CODER IS READY!\")"70   ]71  },72  {73   "cell_type": "markdown",74   "metadata": {},75   "source": [76    "### 3. Vibe Coder Engine Definition"77   ]78  },79  {80   "cell_type": "code",81   "execution_count": null,82   "metadata": {},83   "outputs": [],84   "source": [85    "VIBE_CODER_SYSTEM_PROMPT = \"\"\"You are Vibe Coder, a world-class principal full-stack software engineer and UI/UX designer.\n",86    "ENGINEERING & CODING DIRECTIVES:\n",87    "1. COMPLETE IMPLEMENTATIONS: Never output '// TODO', '/* implement later */', or incomplete stubs. Every component, hook, and route must be fully written.\n",88    "2. NO ARTIFACT STRINGS: Never output template tags, variant numbers (e.g. 'Build Variant #...'), or internal directive texts.\n",89    "3. FULL STATE & INTERACTION: Include real mock data arrays, working toggle logic, and complete TypeScript types.\n",90    "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",91    "5. CLEAN OUTPUT: Output standard, clean TypeScript/React code with 'use client' when state is used.\"\"\"\n",92    "\n",93    "def ask_vibe_coder(prompt_text, temperature=0.2, max_tokens=1500):\n",94    "    if not prompt_text.strip():\n",95    "        print(\"โš ๏ธ Please enter a prompt in the box below.\")\n",96    "        return\n",97    "\n",98    "    messages = [\n",99    "        {\"role\": \"system\", \"content\": VIBE_CODER_SYSTEM_PROMPT},\n",100    "        {\"role\": \"user\", \"content\": prompt_text}\n",101    "    ]\n",102    "    \n",103    "    formatted_prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)\n",104    "    inputs = tokenizer(formatted_prompt, return_tensors=\"pt\").to(\"cuda\")\n",105    "    \n",106    "    print(\"=\" * 75)\n",107    "    print(f\"๐Ÿ’ฌ USER PROMPT: {prompt_text}\")\n",108    "    print(\"=\" * 75 + \"\\n\")\n",109    "    \n",110    "    with torch.no_grad():\n",111    "        model.generate(\n",112    "            **inputs,\n",113    "            streamer=streamer,\n",114    "            max_new_tokens=max_tokens,\n",115    "            temperature=temperature,\n",116    "            top_p=0.95,\n",117    "            repetition_penalty=1.05,\n",118    "            do_sample=True,\n",119    "            eos_token_id=tokenizer.eos_token_id,\n",120    "            pad_token_id=tokenizer.pad_token_id,\n",121    "        )\n",122    "    print(\"\\n\" + \"=\" * 75)"123   ]124  },125  {126   "cell_type": "markdown",127   "metadata": {},128   "source": [129    "### 4. ๐ŸŽฎ Dynamic Prompt Studio (Interactive Form Box)\n",130    "Type your custom prompt into the box below and click the **Play (Run)** button:"131   ]132  },133  {134   "cell_type": "code",135   "execution_count": null,136   "metadata": {137    "cellView": "form"138   },139   "outputs": [],140   "source": [141    "# @title ๐Ÿš€ Vibe Coder Interactive Code Generator { vertical-output: true }\n",142    "# @markdown Enter your custom prompt and configure generation settings:\n",143    "\n",144    "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",145    "temperature = 0.2  # @param {type:\"slider\", min:0.05, max:1.0, step:0.05}\n",146    "max_tokens = 1500  # @param {type:\"slider\", min:256, max:3072, step:128}\n",147    "\n",148    "ask_vibe_coder(prompt, temperature=temperature, max_tokens=max_tokens)"149   ]150  },151  {152   "cell_type": "markdown",153   "metadata": {},154   "source": [155    "### 5. ๐Ÿ’ฌ Continuous Live Chat Loop\n",156    "Run this cell to chat and prompt continuously in real-time:"157   ]158  },159  {160   "cell_type": "code",161   "execution_count": null,162   "metadata": {},163   "outputs": [],164   "source": [165    "while True:\n",166    "    user_query = input(\"\\n๐Ÿ‘‰ Type any prompt (or 'exit' to quit): \")\n",167    "    if not user_query.strip() or user_query.lower() in [\"exit\", \"quit\"]:\n",168    "        print(\"Session stopped.\")\n",169    "        break\n",170    "    ask_vibe_coder(user_query, temperature=0.2)"171   ]172  }173 ],174 "metadata": {175  "accelerator": "GPU",176  "colab": {177   "gpuType": "T4",178   "provenance": []179  },180  "language_info": {181   "name": "python"182  }183 },184 "nbformat": 4,185 "nbformat_minor": 0186}187