Instructions to use mindsofchaos/codeoptics-coder-3b-v3-1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mindsofchaos/codeoptics-coder-3b-v3-1 with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("mindsofchaos/codeoptics-coder-3b-v3-1", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use mindsofchaos/codeoptics-coder-3b-v3-1 with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf mindsofchaos/codeoptics-coder-3b-v3-1:Q4_K_M # Run inference directly in the terminal: llama cli -hf mindsofchaos/codeoptics-coder-3b-v3-1:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf mindsofchaos/codeoptics-coder-3b-v3-1:Q4_K_M # Run inference directly in the terminal: llama cli -hf mindsofchaos/codeoptics-coder-3b-v3-1:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf mindsofchaos/codeoptics-coder-3b-v3-1:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf mindsofchaos/codeoptics-coder-3b-v3-1:Q4_K_M
Use Docker
docker model run hf.co/mindsofchaos/codeoptics-coder-3b-v3-1:Q4_K_M
- Llama new
- LM Studio
- Jan
- Ollama
How to use mindsofchaos/codeoptics-coder-3b-v3-1 with Ollama:
ollama run hf.co/mindsofchaos/codeoptics-coder-3b-v3-1:Q4_K_M
- Unsloth Desktop
- Pi
How to use mindsofchaos/codeoptics-coder-3b-v3-1 with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf mindsofchaos/codeoptics-coder-3b-v3-1:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:9931/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "mindsofchaos/codeoptics-coder-3b-v3-1:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use mindsofchaos/codeoptics-coder-3b-v3-1 with Docker Model Runner:
docker model run hf.co/mindsofchaos/codeoptics-coder-3b-v3-1:Q4_K_M
- Lemonade
How to use mindsofchaos/codeoptics-coder-3b-v3-1 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull mindsofchaos/codeoptics-coder-3b-v3-1:Q4_K_M
Run and chat with the model
lemonade run user.codeoptics-coder-3b-v3-1-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use mindsofchaos/codeoptics-coder-3b-v3-1 with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf mindsofchaos/codeoptics-coder-3b-v3-1:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:9931/v1 hermes config set model.default mindsofchaos/codeoptics-coder-3b-v3-1:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use mindsofchaos/codeoptics-coder-3b-v3-1 with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf mindsofchaos/codeoptics-coder-3b-v3-1:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:9931/v1 \ --custom-model-id "mindsofchaos/codeoptics-coder-3b-v3-1:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Upload codeoptics_v3_5_hybrid_benchmark.ipynb with huggingface_hub
Browse files
codeoptics_v3_5_hybrid_benchmark.ipynb
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"metadata": {},
|
| 6 |
+
"source": [
|
| 7 |
+
"# CodeOptics-Coder v3.5: Hybrid Dual-Mode Benchmark\n",
|
| 8 |
+
"### Empirical Evaluation on Tesla T4 GPU (Kaggle)\n",
|
| 9 |
+
"\n",
|
| 10 |
+
"**Dual-Mode Architecture**:\n",
|
| 11 |
+
"- **Mode 1 (Fast-Path Reflexive)**: Direct synthesis without scratchpad overhead for pure functional & algorithmic tasks (HumanEval, string/math scripts).\n",
|
| 12 |
+
"- **Mode 2 (Deep Second-Order Architect)**: Full 4-part invariant scratchpad for Concurrency, Thread-Safety, State Invariants, and Classes (CEB-15, ClassEval).\n",
|
| 13 |
+
"- **Layer 0 (Compile-Time Hygiene)**: Automatic typing & standard library import injection.\n",
|
| 14 |
+
"- **Layer 4 (Actor-Critic Self-Healing)**: Traceback compiler feedback for functions and multi-method classes."
|
| 15 |
+
]
|
| 16 |
+
},
|
| 17 |
+
{
|
| 18 |
+
"cell_type": "code",
|
| 19 |
+
"execution_count": null,
|
| 20 |
+
"metadata": {},
|
| 21 |
+
"outputs": [],
|
| 22 |
+
"source": [
|
| 23 |
+
"# Cell 1: Hardware Preflight & Ollama GPU Setup\n",
|
| 24 |
+
"import os, sys, time, subprocess, urllib.request\n",
|
| 25 |
+
"\n",
|
| 26 |
+
"print('=' * 75)\n",
|
| 27 |
+
"print('[1/4] Hardware Preflight & Ollama GPU Setup')\n",
|
| 28 |
+
"print('=' * 75)\n",
|
| 29 |
+
"\n",
|
| 30 |
+
"# Kill any old daemon and install required GPU detection utilities\n",
|
| 31 |
+
"subprocess.run('pkill -9 ollama', shell=True)\n",
|
| 32 |
+
"subprocess.run('apt-get update -y && apt-get install -y pciutils zstd', shell=True, check=True)\n",
|
| 33 |
+
"subprocess.run('curl -fsSL https://ollama.com/install.sh | sh', shell=True, check=True)\n",
|
| 34 |
+
"\n",
|
| 35 |
+
"# Launch Ollama background daemon on GPU\n",
|
| 36 |
+
"subprocess.Popen(['ollama', 'serve'], stdout=open('/tmp/ollama.log', 'w'), stderr=subprocess.STDOUT)\n",
|
| 37 |
+
"for _ in range(15):\n",
|
| 38 |
+
" time.sleep(1)\n",
|
| 39 |
+
" try:\n",
|
| 40 |
+
" urllib.request.urlopen('http://127.0.0.1:11434/api/tags', timeout=2)\n",
|
| 41 |
+
" print('[+] Ollama daemon active and listening on Tesla T4 GPU!')\n",
|
| 42 |
+
" break\n",
|
| 43 |
+
" except Exception:\n",
|
| 44 |
+
" pass\n",
|
| 45 |
+
"\n",
|
| 46 |
+
"subprocess.run(['nvidia-smi'], check=False)"
|
| 47 |
+
]
|
| 48 |
+
},
|
| 49 |
+
{
|
| 50 |
+
"cell_type": "code",
|
| 51 |
+
"execution_count": null,
|
| 52 |
+
"metadata": {},
|
| 53 |
+
"outputs": [],
|
| 54 |
+
"source": [
|
| 55 |
+
"# Cell 2: Register Model in Ollama with Stop Tokens\n",
|
| 56 |
+
"print('=' * 75)\n",
|
| 57 |
+
"print('[2/4] Registering Model in Ollama')\n",
|
| 58 |
+
"print('=' * 75)\n",
|
| 59 |
+
"\n",
|
| 60 |
+
"gguf_path = '/kaggle/working/codeoptic-coder-v3.1-q4_k_m.gguf'\n",
|
| 61 |
+
"if not os.path.exists(gguf_path):\n",
|
| 62 |
+
" for alt in ['/tmp/codeoptic-coder-v3.1-q4_k_m.gguf', 'codeoptic-coder-v3.1-q4_k_m.gguf']:\n",
|
| 63 |
+
" if os.path.exists(alt):\n",
|
| 64 |
+
" gguf_path = os.path.abspath(alt)\n",
|
| 65 |
+
" break\n",
|
| 66 |
+
"\n",
|
| 67 |
+
"if not os.path.exists(gguf_path):\n",
|
| 68 |
+
" print('[*] Downloading GGUF from Hugging Face...')\n",
|
| 69 |
+
" gguf_url = 'https://huggingface.co/mindsofchaos/codeoptics-coder-3b-v3-1/resolve/main/codeoptic-coder-v3.1-q4_k_m.gguf'\n",
|
| 70 |
+
" subprocess.run(['wget', '-q', '--show-progress', gguf_url, '-O', gguf_path], check=True)\n",
|
| 71 |
+
"\n",
|
| 72 |
+
"modelfile = f'''FROM {gguf_path}\n",
|
| 73 |
+
"PARAMETER temperature 0.1\n",
|
| 74 |
+
"PARAMETER top_p 0.85\n",
|
| 75 |
+
"PARAMETER num_ctx 8192\n",
|
| 76 |
+
"PARAMETER num_predict 2048\n",
|
| 77 |
+
"PARAMETER stop \"<|im_end|>\"\n",
|
| 78 |
+
"PARAMETER stop \"<|im_start|>\"\n",
|
| 79 |
+
"PARAMETER stop \"<|endoftext|>\"\n",
|
| 80 |
+
"'''\n",
|
| 81 |
+
"with open('/tmp/Modelfile.v3_5', 'w') as f:\n",
|
| 82 |
+
" f.write(modelfile)\n",
|
| 83 |
+
"\n",
|
| 84 |
+
"subprocess.run(['ollama', 'create', 'codeoptic-coder:v3.1', '-f', '/tmp/Modelfile.v3_5'], check=True)\n",
|
| 85 |
+
"print('[+] Model registered in Ollama successfully!')\n",
|
| 86 |
+
"\n",
|
| 87 |
+
"# Quick sanity check\n",
|
| 88 |
+
"t0 = time.time()\n",
|
| 89 |
+
"res = subprocess.run(['ollama', 'run', 'codeoptic-coder:v3.1', 'Output: print(\"READY\")'], capture_output=True, text=True)\n",
|
| 90 |
+
"print(f'[+] Sanity check speed: {time.time()-t0:.2f}s | Output: {res.stdout.strip()[:60]}')"
|
| 91 |
+
]
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"cell_type": "code",
|
| 95 |
+
"execution_count": null,
|
| 96 |
+
"metadata": {},
|
| 97 |
+
"outputs": [],
|
| 98 |
+
"source": [
|
| 99 |
+
"# Cell 3: Pull and Unpack CodeOptics v3.5 Benchmark Suite\n",
|
| 100 |
+
"print('=' * 75)\n",
|
| 101 |
+
"print('[3/4] Pulling CodeOptics v3.5 Hybrid Suite')\n",
|
| 102 |
+
"print('=' * 75)\n",
|
| 103 |
+
"\n",
|
| 104 |
+
"url = 'https://huggingface.co/mindsofchaos/codeoptics-coder-3b-v3-1/resolve/main/codeoptics_benchmark_suite.tar.gz'\n",
|
| 105 |
+
"subprocess.run(['wget', '-q', url, '-O', '/tmp/codeoptics_benchmark_suite.tar.gz'], check=True)\n",
|
| 106 |
+
"subprocess.run(['tar', '-xzf', '/tmp/codeoptics_benchmark_suite.tar.gz', '-C', '/kaggle/working/'], check=True)\n",
|
| 107 |
+
"print('[+] CodeOptics v3.5 Hybrid Engine & Runners unpacked in /kaggle/working/codeoptics/!')"
|
| 108 |
+
]
|
| 109 |
+
},
|
| 110 |
+
{
|
| 111 |
+
"cell_type": "code",
|
| 112 |
+
"execution_count": null,
|
| 113 |
+
"metadata": {},
|
| 114 |
+
"outputs": [],
|
| 115 |
+
"source": [
|
| 116 |
+
"# Cell 4: Execute the Full Hybrid Dual-Mode Benchmark Suite\n",
|
| 117 |
+
"import os, sys, time, subprocess\n",
|
| 118 |
+
"\n",
|
| 119 |
+
"print('=' * 75)\n",
|
| 120 |
+
"print('[4/4] Executing Hybrid Dual-Mode Benchmark Suite (v3.5)')\n",
|
| 121 |
+
"print('=' * 75)\n",
|
| 122 |
+
"\n",
|
| 123 |
+
"os.chdir('/kaggle/working')\n",
|
| 124 |
+
"t_start = time.time()\n",
|
| 125 |
+
"subprocess.run([sys.executable, '-u', 'codeoptics/benchmark/hybrid_runner_v3_5.py', 'codeoptic-coder:v3.1'], check=True)\n",
|
| 126 |
+
"print(f'\\n[SUCCESS] Entire Hybrid Benchmark Suite completed in {time.time() - t_start:.1f}s!')"
|
| 127 |
+
]
|
| 128 |
+
}
|
| 129 |
+
],
|
| 130 |
+
"metadata": {
|
| 131 |
+
"kernelspec": {
|
| 132 |
+
"display_name": "Python 3",
|
| 133 |
+
"language": "python",
|
| 134 |
+
"name": "python3"
|
| 135 |
+
},
|
| 136 |
+
"language_info": {
|
| 137 |
+
"name": "python",
|
| 138 |
+
"version": "3.10.12"
|
| 139 |
+
}
|
| 140 |
+
},
|
| 141 |
+
"nbformat": 4,
|
| 142 |
+
"nbformat_minor": 4
|
| 143 |
+
}
|