shawaz03 commited on
Commit
e4117ea
ยท
verified ยท
1 Parent(s): 746de9a

Add official Google Colab quickstart notebook

Browse files
Files changed (1) hide show
  1. vibe_coder_quickstart.ipynb +163 -0
vibe_coder_quickstart.ipynb ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "# ๐Ÿš€ VIBE CODER v2.0 MAX โ€” Official Google Colab Quickstart\n",
8
+ "\n",
9
+ "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/shawaz03/vibe-coder/blob/main/vibe_coder_quickstart.ipynb)\n",
10
+ "\n",
11
+ "This notebook demonstrates how to run **Vibe Coder v2.0 MAX (7B)** on a **Free Google Colab T4 GPU** using **4-bit NF4 Quantization** (uses only ~5.2 GB VRAM with zero memory warnings).\n",
12
+ "\n",
13
+ "- **Model**: [`shawaz03/vibe-coder-7b-max`](https://huggingface.co/shawaz03/vibe-coder-7b-max)\n",
14
+ "- **Specialization**: Full-Stack React, Next.js 15, TypeScript, Tailwind CSS, Prisma, Zustand, 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
+ "# Install required libraries\n",
31
+ "!pip install -q transformers torch accelerate bitsandbytes huggingface_hub"
32
+ ]
33
+ },
34
+ {
35
+ "cell_type": "markdown",
36
+ "metadata": {},
37
+ "source": [
38
+ "### 2. Load Model in 4-bit (Fast & Zero Memory Overhead)"
39
+ ]
40
+ },
41
+ {
42
+ "cell_type": "code",
43
+ "execution_count": null,
44
+ "metadata": {},
45
+ "outputs": [],
46
+ "source": [
47
+ "import torch\n",
48
+ "from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig, TextStreamer\n",
49
+ "\n",
50
+ "MODEL_ID = \"shawaz03/vibe-coder-7b-max\"\n",
51
+ "\n",
52
+ "print(f\"๐Ÿš€ Loading {MODEL_ID} in 4-bit NF4 for Google Colab...\")\n",
53
+ "\n",
54
+ "# 4-bit configuration (Fits smoothly in 5.2 GB VRAM on Colab T4)\n",
55
+ "bnb_config = BitsAndBytesConfig(\n",
56
+ " load_in_4bit=True,\n",
57
+ " bnb_4bit_quant_type=\"nf4\",\n",
58
+ " bnb_4bit_use_double_quant=True,\n",
59
+ " bnb_4bit_compute_dtype=torch.float16,\n",
60
+ ")\n",
61
+ "\n",
62
+ "tokenizer = AutoTokenizer.from_pretrained(MODEL_ID, trust_remote_code=True)\n",
63
+ "model = AutoModelForCausalLM.from_pretrained(\n",
64
+ " MODEL_ID,\n",
65
+ " quantization_config=bnb_config,\n",
66
+ " device_map=\"auto\",\n",
67
+ " trust_remote_code=True,\n",
68
+ ")\n",
69
+ "model.eval()\n",
70
+ "streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)\n",
71
+ "\n",
72
+ "print(\"\\nโœ… VIBE CODER IS READY TO GENERATE CODE!\")"
73
+ ]
74
+ },
75
+ {
76
+ "cell_type": "markdown",
77
+ "metadata": {},
78
+ "source": [
79
+ "### 3. Interactive Code Generator"
80
+ ]
81
+ },
82
+ {
83
+ "cell_type": "code",
84
+ "execution_count": null,
85
+ "metadata": {},
86
+ "outputs": [],
87
+ "source": [
88
+ "# Vibe Coder System Prompt\n",
89
+ "VIBE_CODER_SYSTEM_PROMPT = \"\"\"You are Vibe Coder, a world-class principal full-stack software engineer and UI/UX designer.\n",
90
+ "ENGINEERING DIRECTIVES:\n",
91
+ "1. ZERO PLACEHOLDERS: Never output '// TODO' or incomplete stubs. Every component, hook, and route must be fully written.\n",
92
+ "2. MODERN DESIGN SYSTEM: Use Tailwind CSS with dark neutral palettes (bg-neutral-900, border-neutral-800), clean accents (cyan, emerald, violet), and Lucide icons.\n",
93
+ "3. TYPE SAFETY: Include full TypeScript interfaces and prop types.\"\"\"\n",
94
+ "\n",
95
+ "def ask_vibe_coder(prompt_text, temperature=0.2, max_tokens=1500):\n",
96
+ " messages = [\n",
97
+ " {\"role\": \"system\", \"content\": VIBE_CODER_SYSTEM_PROMPT},\n",
98
+ " {\"role\": \"user\", \"content\": prompt_text}\n",
99
+ " ]\n",
100
+ " \n",
101
+ " formatted_prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)\n",
102
+ " inputs = tokenizer(formatted_prompt, return_tensors=\"pt\").to(\"cuda\")\n",
103
+ " \n",
104
+ " print(\"=\" * 75)\n",
105
+ " print(f\"๐Ÿš€ PROMPT: {prompt_text}\")\n",
106
+ " print(\"=\" * 75 + \"\\n\")\n",
107
+ " \n",
108
+ " with torch.no_grad():\n",
109
+ " model.generate(\n",
110
+ " **inputs,\n",
111
+ " streamer=streamer,\n",
112
+ " max_new_tokens=max_tokens,\n",
113
+ " temperature=temperature,\n",
114
+ " top_p=0.95,\n",
115
+ " repetition_penalty=1.05,\n",
116
+ " do_sample=True,\n",
117
+ " eos_token_id=tokenizer.eos_token_id,\n",
118
+ " pad_token_id=tokenizer.pad_token_id,\n",
119
+ " )\n",
120
+ " print(\"\\n\" + \"=\" * 75)"
121
+ ]
122
+ },
123
+ {
124
+ "cell_type": "markdown",
125
+ "metadata": {},
126
+ "source": [
127
+ "### 4. Run Example Prompts"
128
+ ]
129
+ },
130
+ {
131
+ "cell_type": "code",
132
+ "execution_count": null,
133
+ "metadata": {},
134
+ "outputs": [],
135
+ "source": [
136
+ "# Example 1: Full-Stack Component\n",
137
+ "ask_vibe_coder(\"Build an interactive pricing card in React with Tailwind CSS, monthly/annual toggle, and checkmark feature list.\")"
138
+ ]
139
+ },
140
+ {
141
+ "cell_type": "code",
142
+ "execution_count": null,
143
+ "metadata": {},
144
+ "outputs": [],
145
+ "source": [
146
+ "# Example 2: Next.js Server Action\n",
147
+ "ask_vibe_coder(\"Write a Next.js Server Action with Zod validation to update user settings with error handling.\")"
148
+ ]
149
+ }
150
+ ],
151
+ "metadata": {
152
+ "accelerator": "GPU",
153
+ "colab": {
154
+ "gpuType": "T4",
155
+ "provenance": []
156
+ },
157
+ "language_info": {
158
+ "name": "python"
159
+ }
160
+ },
161
+ "nbformat": 4,
162
+ "nbformat_minor": 0
163
+ }