Ely-Eye — local multimodal context operating system on Qwen3.5-9B

Real-models implementation: multimodal ingestion, Context Cartridge memory,
sparse + Qwen embedding retrieval, Cache Fabric, Qwen runtime adapters, verifier
contracts, Visual HashHop proofs, BF16 LoRA fine-tuning, and a local dashboard.
Verified by a 15-check PRD proof suite on the live model.
This commit is contained in:
ZacharyZhang-NY committed 2026-05-28 22:08:08 -04:00
commit 0ee99e271d
64 files changed
+14890

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
$ErrorActionPreference = "Stop"
Set-Location (Split-Path -Parent $PSScriptRoot)
.\.venv\Scripts\python.exe .\scripts\download_models.py --model Qwen/Qwen3.5-9B
.\.venv\Scripts\python.exe .\scripts\download_models.py --model Qwen/Qwen3.5-0.8B
.\.venv\Scripts\python.exe .\scripts\download_models.py --model Qwen/Qwen3-VL-Embedding-8B
+17
View File
@@ -0,0 +1,17 @@
from __future__ import annotations
import argparse
from huggingface_hub import snapshot_download
def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument("--model", required=True)
args = parser.parse_args()
path = snapshot_download(repo_id=args.model, resume_download=True)
print(path)
if __name__ == "__main__":
main()
+5
View File
@@ -0,0 +1,5 @@
$ErrorActionPreference = "Stop"
Set-Location (Split-Path -Parent $PSScriptRoot)
.\.venv\Scripts\python.exe -m pip install --upgrade --no-cache-dir --index-url https://download.pytorch.org/whl/cu130 torch==2.12.0+cu130 torchvision==0.27.0+cu130
.\.venv\Scripts\python.exe -c "import torch; print(torch.__version__); print(torch.cuda.is_available()); print(torch.version.cuda)"
+21
View File
@@ -0,0 +1,21 @@
$ErrorActionPreference = "Stop"
Set-Location (Split-Path -Parent $PSScriptRoot)
if (-not (Test-Path ".venv")) {
python -m venv .venv
}
.\.venv\Scripts\python.exe -m pip install --upgrade pip setuptools wheel
.\.venv\Scripts\python.exe -m pip install -e .\backend
.\.venv\Scripts\python.exe -m pip install --upgrade --no-cache-dir unsloth unsloth_zoo
.\.venv\Scripts\python.exe -m pip install --upgrade --no-cache-dir --index-url https://download.pytorch.org/whl/cu130 torch==2.12.0+cu130 torchvision==0.27.0+cu130
.\.venv\Scripts\python.exe -m pip install --upgrade --no-cache-dir transformers==5.9.0 datasets==4.8.5 dill==0.4.1 multiprocess==0.70.19 fsspec==2026.2.0 safetensors==0.8.0rc0
Push-Location .\frontend
npm install
Pop-Location
Copy-Item .env.example .env -ErrorAction SilentlyContinue
.\.venv\Scripts\ely-eye.exe status
+23
View File
@@ -0,0 +1,23 @@
$ErrorActionPreference = "Stop"
Set-Location (Split-Path -Parent $PSScriptRoot)
if (-not (Get-Command wsl.exe -ErrorAction SilentlyContinue)) {
throw "WSL is required for the KTransformers Linux runtime."
}
$wslRoot = (wsl.exe -d Ubuntu wslpath -a (Get-Location).Path).Trim()
$command = @"
set -euo pipefail
cd "$wslRoot"
source .venv-linux/bin/activate
export SGLANG_ALLOW_OVERWRITE_LONGER_CONTEXT_LEN=1
python -m sglang.launch_server \
--model-path Qwen/Qwen3.5-9B \
--port 8002 \
--context-length 1010000 \
--kt-cpuinfer 16 \
--cpu-offload-gb 48
"@
wsl.exe -d Ubuntu -- bash -lc $command
+35
View File
@@ -0,0 +1,35 @@
$ErrorActionPreference = "Stop"
Set-Location (Split-Path -Parent $PSScriptRoot)
if (-not $env:ELY_EYE_GGUF_MODEL) {
throw "Set ELY_EYE_GGUF_MODEL to the absolute GGUF model path."
}
$server = $env:LLAMA_CPP_SERVER
if (-not $server) {
$server = "llama-server"
}
if (-not (Get-Command $server -ErrorAction SilentlyContinue)) {
$wingetPackageRoot = Join-Path $env:LOCALAPPDATA "Microsoft\WinGet\Packages"
$installed = Get-ChildItem $wingetPackageRoot -Recurse -Filter llama-server.exe -ErrorAction SilentlyContinue |
Where-Object { $_.FullName -like "*ggml.llamacpp*" } |
Select-Object -First 1
if ($installed) {
$server = $installed.FullName
}
}
if (-not (Get-Command $server -ErrorAction SilentlyContinue)) {
throw "llama-server executable is missing. Install ggml.llamacpp or set LLAMA_CPP_SERVER."
}
& $server `
--model $env:ELY_EYE_GGUF_MODEL `
--host 127.0.0.1 `
--port 8003 `
--ctx-size 262144 `
--flash-attn `
--cache-type-k q4_0 `
--cache-type-v q4_0
+25
View File
@@ -0,0 +1,25 @@
$ErrorActionPreference = "Stop"
Set-Location (Split-Path -Parent $PSScriptRoot)
if (-not (Get-Command wsl.exe -ErrorAction SilentlyContinue)) {
throw "WSL is required for the SGLang Linux runtime."
}
$override = '{"text_config":{"rope_parameters":{"mrope_interleaved":true,"mrope_section":[11,11,10],"rope_type":"yarn","rope_theta":10000000,"partial_rotary_factor":0.25,"factor":4.0,"original_max_position_embeddings":262144}}}'
$wslRoot = (wsl.exe -d Ubuntu wslpath -a (Get-Location).Path).Trim()
$command = @"
set -euo pipefail
cd "$wslRoot"
source .venv-linux/bin/activate
export SGLANG_ALLOW_OVERWRITE_LONGER_CONTEXT_LEN=1
python -m sglang.launch_server \
--model-path Qwen/Qwen3.5-9B \
--port 8000 \
--tp-size 1 \
--mem-fraction-static 0.88 \
--context-length 1010000 \
--json-model-override-args '$override'
"@
wsl.exe -d Ubuntu -- bash -lc $command
+26
View File
@@ -0,0 +1,26 @@
$ErrorActionPreference = "Stop"
Set-Location (Split-Path -Parent $PSScriptRoot)
if (-not (Get-Command wsl.exe -ErrorAction SilentlyContinue)) {
throw "WSL is required for the SGLang Linux runtime."
}
$wslRoot = (wsl.exe -d Ubuntu wslpath -a (Get-Location).Path).Trim()
$command = @"
set -euo pipefail
cd "$wslRoot"
source .venv-linux/bin/activate
python -m sglang.launch_server \
--model-path Qwen/Qwen3.5-9B \
--port 8000 \
--tp-size 1 \
--mem-fraction-static 0.82 \
--context-length 262144 \
--reasoning-parser qwen3 \
--speculative-algo NEXTN \
--speculative-num-steps 3 \
--speculative-num-draft-tokens 4
"@
wsl.exe -d Ubuntu -- bash -lc $command
+26
View File
@@ -0,0 +1,26 @@
$ErrorActionPreference = "Stop"
Set-Location (Split-Path -Parent $PSScriptRoot)
if (-not (Get-Command wsl.exe -ErrorAction SilentlyContinue)) {
throw "WSL is required for the vLLM Linux runtime."
}
$wslRoot = (wsl.exe -d Ubuntu wslpath -a (Get-Location).Path).Trim()
$ropeScaling = '{"rope_type":"yarn","factor":4.0,"original_max_position_embeddings":262144}'
$command = @"
set -euo pipefail
cd "$wslRoot"
source .venv-linux-vllm/bin/activate
python -m vllm.entrypoints.openai.api_server \
--model Qwen/Qwen3.5-9B \
--host 127.0.0.1 \
--port 8001 \
--max-model-len 1010000 \
--enable-prefix-caching \
--gpu-memory-utilization 0.88 \
--trust-remote-code \
--rope-scaling '$ropeScaling'
"@
wsl.exe -d Ubuntu -- bash -lc $command
+24
View File
@@ -0,0 +1,24 @@
$ErrorActionPreference = "Stop"
Set-Location (Split-Path -Parent $PSScriptRoot)
if (-not (Get-Command wsl.exe -ErrorAction SilentlyContinue)) {
throw "WSL is required for the vLLM Linux runtime."
}
$wslRoot = (wsl.exe -d Ubuntu wslpath -a (Get-Location).Path).Trim()
$command = @"
set -euo pipefail
cd "$wslRoot"
source .venv-linux-vllm/bin/activate
python -m vllm.entrypoints.openai.api_server \
--model Qwen/Qwen3.5-9B \
--host 127.0.0.1 \
--port 8001 \
--max-model-len 262144 \
--enable-prefix-caching \
--gpu-memory-utilization 0.82 \
--trust-remote-code
"@
wsl.exe -d Ubuntu -- bash -lc $command
+100
View File
@@ -0,0 +1,100 @@
param(
[string]$CartridgeId = "ely_eye_prd_7e5cd27b8284",
[int]$MaxLength = 8192
)
$ErrorActionPreference = "Stop"
$root = Split-Path -Parent $PSScriptRoot
Set-Location $root
$proofImage = Join-Path $root ".ely_eye\proofs\ely-eye-dashboard.png"
$coreDataset = Join-Path $root ".ely_eye\training\hme_prd_sft.jsonl"
$visualDataset = Join-Path $root ".ely_eye\training\hme_visual_sft.jsonl"
$routerDataset = Join-Path $root ".ely_eye\training\hme_router_sft.jsonl"
$retrievalDataset = Join-Path $root ".ely_eye\training\hme_retrieval_pairs.jsonl"
.\.venv\Scripts\ely-eye.exe build-prd-training-data `
--prd-path .\PRD.md `
--output-path $coreDataset `
--max-sections 48
.\.venv\Scripts\ely-eye.exe build-visual-training-data `
--prd-path .\PRD.md `
--output-path $visualDataset `
--cartridge-id $CartridgeId `
--image-path $proofImage
.\.venv\Scripts\ely-eye.exe build-router-training-data `
--prd-path .\PRD.md `
--output-path $routerDataset `
--cartridge-id $CartridgeId
.\.venv\Scripts\ely-eye.exe build-retrieval-training-data `
--prd-path .\PRD.md `
--output-path $retrievalDataset `
--cartridge-id $CartridgeId `
--max-sections 32
.\.venv\Scripts\ely-eye.exe train-lora `
$coreDataset `
.\.ely_eye\adapters\hme_core_lora_qwen35_9b `
--max-steps 37 `
--kind hme_core_lora `
--rank 16 `
--alpha 32 `
--max-length $MaxLength `
--gradient-accumulation-steps 4 `
--cartridge-id $CartridgeId
.\.venv\Scripts\ely-eye.exe train-lora `
$visualDataset `
.\.ely_eye\adapters\hme_vision_lora_qwen35_9b `
--max-steps 20 `
--kind hme_vision_lora `
--rank 4 `
--alpha 8 `
--max-length $MaxLength `
--gradient-accumulation-steps 4 `
--cartridge-id $CartridgeId
.\.venv\Scripts\ely-eye.exe train-lora `
$visualDataset `
.\.ely_eye\adapters\hme_ttt_vl_qwen35_9b `
--max-steps 20 `
--kind hme_ttt_vl `
--rank 4 `
--alpha 8 `
--max-length $MaxLength `
--gradient-accumulation-steps 4 `
--cartridge-id $CartridgeId
.\.venv\Scripts\ely-eye.exe train-lora `
$visualDataset `
.\.ely_eye\adapters\hme_visual_mtp_qwen35_9b `
--max-steps 20 `
--kind hme_visual_mtp `
--rank 4 `
--alpha 8 `
--max-length $MaxLength `
--gradient-accumulation-steps 4 `
--cartridge-id $CartridgeId
.\.venv\Scripts\ely-eye.exe train-lora `
$routerDataset `
.\.ely_eye\adapters\hme_router_qwen35_08b `
--max-steps 16 `
--kind hme_router `
--rank 8 `
--alpha 16 `
--max-length $MaxLength `
--gradient-accumulation-steps 4 `
--cartridge-id $CartridgeId
.\.venv\Scripts\ely-eye.exe train-retrieval-lora `
$retrievalDataset `
.\.ely_eye\adapters\hme_retrieval_qwen3_vl_embedding_8b `
--max-steps 32 `
--rank 8 `
--alpha 16 `
--max-length $MaxLength `
--cartridge-id $CartridgeId
+41
View File
@@ -0,0 +1,41 @@
param(
[int]$MaxSteps = 37,
[int]$Rank = 16,
[int]$Alpha = 32,
[int]$MaxLength = 8192,
[int]$GradientAccumulationSteps = 4,
[string]$CartridgeId = ""
)
$ErrorActionPreference = "Stop"
$root = Split-Path -Parent $PSScriptRoot
Set-Location $root
$dataset = Join-Path $root ".ely_eye\training\hme_prd_sft.jsonl"
$adapter = Join-Path $root ".ely_eye\adapters\hme_core_lora_qwen35_9b"
.\.venv\Scripts\ely-eye.exe build-prd-training-data `
--prd-path .\PRD.md `
--output-path $dataset `
--max-sections 48
$args = @(
"train-lora",
$dataset,
$adapter,
"--max-steps", "$MaxSteps",
"--kind", "hme_core_lora",
"--rank", "$Rank",
"--alpha", "$Alpha",
"--max-length", "$MaxLength",
"--gradient-accumulation-steps", "$GradientAccumulationSteps"
)
if ($CartridgeId.Length -gt 0) {
$args += @("--cartridge-id", $CartridgeId)
}
.\.venv\Scripts\ely-eye.exe @args
Write-Host "Adapter ready: $adapter"
Write-Host "Use with: `$env:ELY_EYE_ADAPTER_DIR='$adapter'"
+4
View File
@@ -0,0 +1,4 @@
$ErrorActionPreference = "Stop"
Set-Location (Split-Path -Parent $PSScriptRoot)
.\.venv\Scripts\ely-eye.exe serve --host 127.0.0.1 --port 8765
+6
View File
@@ -0,0 +1,6 @@
$ErrorActionPreference = "Stop"
Set-Location (Split-Path -Parent $PSScriptRoot)
Push-Location .\frontend
npm run dev
Pop-Location
+23
View File
@@ -0,0 +1,23 @@
$ErrorActionPreference = "Stop"
Set-Location (Split-Path -Parent $PSScriptRoot)
if (-not (Get-Command wsl.exe -ErrorAction SilentlyContinue)) {
throw "WSL is required for SGLang, vLLM, and KTransformers runtime profiles."
}
wsl.exe -d Ubuntu -- bash -lc "command -v nvidia-smi >/dev/null && nvidia-smi -L >/dev/null"
wsl.exe -d Ubuntu -- bash -lc "command -v curl >/dev/null || (apt-get update && apt-get install -y curl)"
wsl.exe -d Ubuntu -- bash -lc "command -v /root/.local/bin/uv >/dev/null || curl -LsSf https://astral.sh/uv/install.sh | sh"
$wslRoot = (wsl.exe -d Ubuntu wslpath -a (Get-Location).Path).Trim()
wsl.exe -d Ubuntu -- bash -lc "cd '$wslRoot' && /root/.local/bin/uv venv .venv-linux --python 3.12"
wsl.exe -d Ubuntu -- bash -lc "cd '$wslRoot' && /root/.local/bin/uv venv .venv-linux-vllm --python 3.12"
wsl.exe -d Ubuntu -- bash -lc "cd '$wslRoot' && source .venv-linux/bin/activate && /root/.local/bin/uv pip install --prerelease=allow -r backend/requirements-sglang-linux.txt"
wsl.exe -d Ubuntu -- bash -lc "cd '$wslRoot' && source .venv-linux-vllm/bin/activate && /root/.local/bin/uv pip install --prerelease=allow -r backend/requirements-vllm-linux.txt"
wsl.exe -d Ubuntu -- bash -lc "cd '$wslRoot' && source .venv-linux/bin/activate && /root/.local/bin/uv pip install --prerelease=allow -r backend/requirements-ktransformers-linux.txt"
if (-not (Get-Command llama-server -ErrorAction SilentlyContinue)) {
winget install --id ggml.llamacpp -e --accept-package-agreements --accept-source-agreements
}
.\.venv\Scripts\ely-eye.exe runtime-profiles
+10
View File
@@ -0,0 +1,10 @@
$ErrorActionPreference = "Stop"
Set-Location (Split-Path -Parent $PSScriptRoot)
.\.venv\Scripts\python.exe -m compileall .\backend\src
.\.venv\Scripts\ely-eye.exe status
Push-Location .\frontend
npm run build
Pop-Location