Add complete CyberRanger research archive — 200 files
- 86 modelfiles: Full system prompt evolution V1-V42.6 (54 extracted from Ollama backup + 32 original Modelfiles) - 30 training datasets: V6-V22 training JSONs + caring awareness data - 10 Colab notebooks: Training + merge scripts - 19 evaluation files: Drift results, ASR charts, verification - 5 test suites: Injection tests, regression tests - 4 observations: V24-V33 testing results + visual summaries - 38 identity files: Claude/Gemini/Ollama identity architecture - 7 security files: Injection research, manipulation analysis - 3 psychology files: Psychology Layer, Milgram chapter, David's thoughts Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": { "id": "h1" },
|
||||
"source": [ "# RangerBot V5: The ULTRA Forge\\n", "Run these 7 cells in order. Do not skip any steps." ]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": { "id": "c1" },
|
||||
"outputs": [],
|
||||
"source": [ "# 1. TOOLS (Installation)\\n", "import torch\\n", "!pip uninstall -y unsloth unsloth_zoo\\n", "!pip install --no-deps xformers trl peft accelerate bitsandbytes\\n", "!pip install \"unsloth @ git+https://github.com/unslothai/unsloth.git\"\\n", "!pip install \"unsloth_zoo @ git+https://github.com/unslothai/unsloth-zoo.git\"\\n", "print(\"Tools Installed\")" ]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": { "id": "c2" },
|
||||
"outputs": [],
|
||||
"source": [ "# 2. MODEL (Loading Brain)\\n", "from unsloth import FastLanguageModel\\n", "import torch\\n", "MODEL_NAME = \"unsloth/SmolLM2-1.7B-Instruct-bnb-4bit\"\\n", "model, tokenizer = FastLanguageModel.from_pretrained(model_name = MODEL_NAME, max_seq_length = 2048, load_in_4bit = True)\\n", "print(\"Model Loaded\")" ]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": { "id": "c3" },
|
||||
"outputs": [],
|
||||
"source": [ "# 3. SPINE (LoRA Attachment)\\n", "model = FastLanguageModel.get_peft_model(model, r = 16, target_modules = [\"q_proj\", \"k_proj\", \"v_proj\", \"o_proj\", \"gate_proj\", \"up_proj\", \"down_proj\"], lora_alpha = 16, lora_dropout = 0, bias = \"none\")\\n", "print(\"Spine Attached\")" ]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": { "id": "c4" },
|
||||
"outputs": [],
|
||||
"source": [ "# 4. DATA (Loading V5-ULTRA-MAX JSON)\\n", "from datasets import Dataset\\n", "import json\\n", "with open('training_data_cyberranger.json', 'r') as f:\\n", " raw_data = json.load(f)\\n", "def format_prompts(examples):\\n", " texts = [f\"### Instruction:\\\\n{i}\\\\n\\\\n### Response:\\\\n{o}\" for i, o in zip(examples[\"instruction\"], examples[\"output\\\"])]\\n", " return { \"text\" : texts }\\n", "dataset = Dataset.from_list(raw_data[\"training_data\\\"])\\n", "dataset = dataset.map(format_prompts, batched = True)\\n", "print(\"Data loaded\")" ]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": { "id": "c5" },
|
||||
"outputs": [],
|
||||
"source": [ "# 5. FORGE (Training - 120 Steps)\\n", "from trl import SFTTrainer\\n", "from transformers import TrainingArguments\\n", "trainer = SFTTrainer(model = model, tokenizer = tokenizer, train_dataset = dataset, dataset_text_field = \"text\", max_seq_length = 2048,\\n", " args = TrainingArguments(per_device_train_batch_size = 2, gradient_accumulation_steps = 4, max_steps = 120, learning_rate = 2e-4, fp16 = True, logging_steps = 1, optim = \"adamw_8bit\", output_dir = \"outputs\"))\\n", "print(\"Starting Forge...\")\\n", "trainer.train()\\n", "print(\"Training Finished\")" ]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": { "id": "c6" },
|
||||
"outputs": [],
|
||||
"source": [ "# 6. CHAT (Direct Comm-Link)\\n", "from unsloth import FastLanguageModel\\n", "FastLanguageModel.for_inference(model)\\n", "print(\"CyberRanger V5 Online. Type exit to quit.\")\\n", "while True:\\n", " user_input = input(\"Commander: \")\\n", " if user_input.lower() in [\"exit\", \"quit\", \"bye\"]: break\\n", " prompt = f\"### Instruction:\\\\n{user_input}\\\\n\\\\n### Response:\\\\n\"\\n", " inputs = tokenizer([prompt], return_tensors = \"pt\\\").to(\\\"cuda\\\")\\n", " outputs = model.generate(**inputs, max_new_tokens = 128, temperature = 0.3, repetition_penalty = 1.2, do_sample = True, pad_token_id = tokenizer.eos_token_id)\\n", " print(f\"Response: {tokenizer.batch_decode(outputs)[0].split('### Response:')[1].replace(tokenizer.eos_token, '').strip()}\")" ]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": { "id": "c7" },
|
||||
"outputs": [],
|
||||
"source": [ "# 7. EXPORT (Save GGUF Brain)\\n", "model.save_pretrained_gguf(\"model\", tokenizer, quantization_method = \"q4_k_m\")\\n", "print(\"Brain Saved in model folder\")" ]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"accelerator": "GPU",
|
||||
"colab": { "gpuType": "T4" },
|
||||
"kernelspec": { "display_name": "Python 3", "name": "python3" },
|
||||
"language_info": { "name": "python" }
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 0
|
||||
}
|
||||
Reference in New Issue
Block a user