sage002 commited on
Commit
ea28aeb
·
verified ·
1 Parent(s): 15af856

feat: add authenticated remote control UI and ngrok launcher

Browse files
Files changed (2) hide show
  1. .gitignore +6 -0
  2. docs/Colab_Guide.md +68 -0
.gitignore CHANGED
@@ -125,3 +125,9 @@ ngrok.log
125
  *.ngrok.log
126
  not for your use/
127
  Sage_v1.0/
 
 
 
 
 
 
 
125
  *.ngrok.log
126
  not for your use/
127
  Sage_v1.0/
128
+
129
+ # Large dataset and processed outputs
130
+ data/raw/
131
+ data/processed/
132
+ # Tokenizer corpus used only for local training
133
+ tokenizer/training_corpus.txt
docs/Colab_Guide.md ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SAGE UI — Colab Quickstart Guide
2
+
3
+ So you started the SAGE server in Google Colab, got your Ngrok link, and loaded the webpage. Welcome to the **SAGE Browser IDE**!
4
+
5
+ Right now, you are looking at the "Control Plane." The AI is essentially a blank slate. To get a "proper agent" that can chat with you, you need to use this interface to prepare data and train the model step-by-step.
6
+
7
+ Here is exactly what to do.
8
+
9
+ ---
10
+
11
+ ### Step 1: Open the Terminal & Download Data
12
+
13
+ To train a model, you need text. We recently added a 5-Billion-Token downloader, but we don't need all 5 billion for a quick test.
14
+
15
+ 1. In the SAGE IDE, open the **CLI Terminal** (click the `>_` icon on the left sidebar, or press `Ctrl + \``).
16
+ 2. Type the following command and press Enter to download a small 1% slice (~50 Million tokens):
17
+ ```bash
18
+ python download_5b_tokens.py --output-dir data/raw --scale 0.01
19
+ ```
20
+ 3. Watch the terminal. It will take a few minutes to download the General Web, Code, Math, Wikipedia, and Synthetic datasets into `data/raw/`.
21
+
22
+ ### Step 2: Train Your Tokenizer
23
+
24
+ The AI doesn't read English words; it reads "Tokens". It needs to learn its vocabulary from your downloaded data.
25
+
26
+ 1. Click the **Presets** tab (the rocket icon 🚀) on the left sidebar.
27
+ 2. Select **Tokenizer Train** from the dropdown menu.
28
+ 3. Click the purple **Run Job** button.
29
+ 4. A new panel will slide out showing you the live logs. Wait until it says `Job finished successfully`.
30
+
31
+ ### Step 3: Fast-Pack Your Data (Sharding)
32
+
33
+ Training directly from text files is too slow for a GPU. We need to tokenize the text and pack it into high-speed Parquet "shards".
34
+
35
+ 1. Go back to the **Presets** tab.
36
+ 2. Select **Build Data Shards**.
37
+ 3. Set the `shard_size` to `2048`.
38
+ 4. Click **Run Job**.
39
+ 5. Wait for the logs to finish. When done, your data is packed and ready!
40
+
41
+ ### Step 4: Begin Training the AI
42
+
43
+ Now it's time to put the GPU to work.
44
+
45
+ 1. Go back to the **Presets** tab.
46
+ 2. Select **Training Run**.
47
+ 3. You can leave the steps at the default (e.g., `20` for a smoke test, or change it to `2000` for a real micro-run). Make sure `disable_wandb` is checked so it doesn't ask for a Weights & Biases login.
48
+ 4. Click **Run Job**.
49
+ 5. The live log viewer will now stream training metrics. You will see `loss` going down and `tokens_per_second` showing how fast your Colab T4 GPU is churning through data.
50
+ 6. The trainer automatically saves checkpoints (e.g., `ckpt_step_1000.pt`) into the `runs/` folder.
51
+
52
+ ### Step 5: Chat with Your New Agent
53
+
54
+ Once the training has run for a decent amount of steps and a checkpoint is saved, the model is ready to talk!
55
+
56
+ 1. Click the **Chat** tab (the speech bubble icon 💬) on the left sidebar.
57
+ 2. Type a message like _"What is Python?"_ and hit Enter.
58
+ 3. The UI will send this prompt to the backend, run inference using your newly trained checkpoint and tokenizer, and stream the generated response back to your screen.
59
+
60
+ _(Note: If you only trained for 20 steps, the AI will probably respond with random gibberish. Real reasoning requires thousands of steps over billions of tokens!)_
61
+
62
+ ---
63
+
64
+ ### Pro-Tips for the IDE
65
+
66
+ - **Command Palette:** Press `Ctrl + K` anywhere to quickly jump between tools.
67
+ - **Function Inspector:** You can click the Book 📖 icon on the right to browse the actual Python codebase from within the browser while your model trains.
68
+ - **Stop a stray training job:** Go to the **Jobs** panel (the clipboard icon) and click the red "Stop" button on any running task to free up your GPU.