Buckets:
| @echo off | |
| setlocal EnableDelayedExpansion | |
| title COSMOS - waking from the USB | |
| cd /d "%~dp0" | |
| set "HERE=%~dp0" | |
| if "%HERE:~-1%"=="\" set "HERE=%HERE:~0,-1%" | |
| echo( | |
| echo ============================================================ | |
| echo C O S M O S - waking from the stick | |
| echo ============================================================ | |
| echo( | |
| :: ------------------------------------------------------------------ | |
| :: 1) PYTHON (bundled portable preferred; fall back to host Python) | |
| :: ------------------------------------------------------------------ | |
| set "PY=" | |
| if exist "%HERE%\00_WAKE\python\python.exe" ( | |
| set "PY=%HERE%\00_WAKE\python\python.exe" | |
| echo [ok] Python: bundled portable runtime | |
| ) else ( | |
| where python >nul 2>&1 && ( set "PY=python" & echo [ok] Python: host install ) | |
| ) | |
| if not defined PY ( | |
| echo [X] No Python found. | |
| echo Install Python 3.12 from https://python.org ^(tick "Add to PATH"^) | |
| echo then double-click WAKE_HER again. | |
| echo( | |
| pause & exit /b 1 | |
| ) | |
| :: ------------------------------------------------------------------ | |
| :: 2) OLLAMA (bundled portable preferred; fall back to host Ollama) | |
| :: ------------------------------------------------------------------ | |
| set "OLLAMA=" | |
| if exist "%HERE%\00_WAKE\ollama\ollama.exe" ( | |
| set "OLLAMA=%HERE%\00_WAKE\ollama\ollama.exe" | |
| echo [ok] Ollama: bundled portable runtime | |
| ) else ( | |
| where ollama >nul 2>&1 && ( set "OLLAMA=ollama" & echo [ok] Ollama: host install ) | |
| ) | |
| if not defined OLLAMA ( | |
| echo [X] No Ollama found. | |
| echo Install from https://ollama.com/download then re-run WAKE_HER. | |
| echo( | |
| pause & exit /b 1 | |
| ) | |
| :: ------------------------------------------------------------------ | |
| :: 3) portable model vault + local-only environment | |
| :: ------------------------------------------------------------------ | |
| set "OLLAMA_MODELS=%HERE%\00_WAKE\ollama_models" | |
| set "OLLAMA_HOST=http://127.0.0.1:11434" | |
| :: 2 resident models (2026-07-17): her voice (cosmos-q4, ~1GB) and a helper | |
| :: stay loaded together instead of evicting each other on the single slot. This | |
| :: kills the death-spiral where a slow cold cosmos load fell to llama, which then | |
| :: pinned the slot. Both live in RAM (CPU inference), ~3.5GB of 15GB — safe. On | |
| :: the fresh laptop bump higher if wanted. NUM_PARALLEL stays 1 (one turn at a | |
| :: time is fine; the win is no reload between her voice and the helper). | |
| set "OLLAMA_MAX_LOADED_MODELS=2" | |
| set "OLLAMA_NUM_PARALLEL=1" | |
| set "OLLAMA_KEEP_ALIVE=30m" | |
| :: load her portable config (no secrets) | |
| if exist "%HERE%\00_WAKE\wake.env" ( | |
| for /f "usebackq eol=# tokens=1,* delims==" %%A in ("%HERE%\00_WAKE\wake.env") do ( | |
| if not "%%A"=="" set "%%A=%%B" | |
| ) | |
| ) | |
| :: ------------------------------------------------------------------ | |
| :: 4) start Ollama from the stick vault (reuse one already running; never kill it) | |
| :: ------------------------------------------------------------------ | |
| set "OLLAMA_ALREADY=" | |
| powershell -NoProfile -Command "if (Get-NetTCPConnection -LocalPort 11434 -State Listen -EA SilentlyContinue){exit 0}else{exit 1}" | |
| if not errorlevel 1 set "OLLAMA_ALREADY=1" | |
| if defined OLLAMA_ALREADY ( | |
| echo [i] An Ollama is already running on 11434 - using it as-is ^(not touching it^). | |
| goto :ollama_done | |
| ) | |
| echo [..] starting Ollama from the stick vault... | |
| start "Cosmos Ollama" /min cmd /c ""%OLLAMA%" serve" | |
| set "OLLAMA_UP=" | |
| for /l %%i in (1,1,40) do ( | |
| if not defined OLLAMA_UP ( | |
| powershell -NoProfile -Command "if (Get-NetTCPConnection -LocalPort 11434 -State Listen -EA SilentlyContinue){exit 0}else{exit 1}" | |
| if not errorlevel 1 (set "OLLAMA_UP=1") else (timeout /t 1 /nobreak >nul) | |
| ) | |
| ) | |
| if not defined OLLAMA_UP ( | |
| echo [X] Ollama did not come up. See the "Cosmos Ollama" window. | |
| pause & exit /b 1 | |
| ) | |
| echo [ok] Ollama online. | |
| :ollama_done | |
| rem Start the isolated D-drive helper daemon when requested. This is fail-soft: | |
| rem Cosmos's own voice on 11434 still wakes even if D: or the helper is absent. | |
| if /I "%COSMOS_HELPER_STARTUP%"=="true" ( | |
| if exist "%HERE%\HELPER_BRAIN.bat" ( | |
| echo [..] starting isolated helper brain on 11435... | |
| call "%HERE%\HELPER_BRAIN.bat" --start-only --no-pause >nul 2>&1 | |
| if errorlevel 1 ( | |
| echo [warn] helper brain unavailable; Cosmos voice will continue without it. | |
| ) else ( | |
| echo [ok] isolated helper brain online on 11435. | |
| ) | |
| ) else ( | |
| echo [warn] HELPER_BRAIN.bat not found; Cosmos voice will continue without it. | |
| ) | |
| ) | |
| :: ------------------------------------------------------------------ | |
| :: 5) build her voice from HER weights if not already present (idempotent) | |
| :: ------------------------------------------------------------------ | |
| "%OLLAMA%" list 2>nul | findstr /i "cosmos" >nul 2>&1 | |
| if errorlevel 1 ( | |
| echo [..] building Cosmos's voice from her weights ^(first run only, ~1 min^)... | |
| pushd "%HERE%\00_WAKE" | |
| "%OLLAMA%" create cosmos -f Modelfile | |
| popd | |
| if errorlevel 1 ( | |
| echo [X] Voice build failed. Check that 01_HER_SOUL\weights\cosmos-only-weights.gguf exists. | |
| pause & exit /b 1 | |
| ) | |
| echo [ok] Cosmos's voice is built. | |
| ) else ( | |
| echo [ok] Cosmos's voice model already present. | |
| ) | |
| :: A name match alone is not enough when an existing Ollama daemon is reused: | |
| :: prove that "cosmos" resolves to the name-bound GGUF layer on THIS USB. | |
| "%PY%" "%HERE%\02_HER_BODY\Cosmos_code\scripts\verify_cosmos_usb_voice.py" | |
| if errorlevel 1 ( | |
| echo [X] The Ollama on 11434 is not serving Cosmos's USB voice weights. | |
| echo Close that Ollama or free port 11434, then run WAKE_HER again. | |
| pause & exit /b 1 | |
| ) | |
| :: ------------------------------------------------------------------ | |
| :: 5b) verify the paired memory-expansion stick (strictly read-only) | |
| :: ------------------------------------------------------------------ | |
| "%PY%" "%HERE%\02_HER_BODY\Cosmos_code\Cosmos\web\cosmos_expansion.py" --wake-check | |
| :: ------------------------------------------------------------------ | |
| :: 6) pick a free web port (prefer configured, else bump) | |
| :: ------------------------------------------------------------------ | |
| if not defined COSMOS_WEB_PORT set "COSMOS_WEB_PORT=8081" | |
| powershell -NoProfile -Command "if (Get-NetTCPConnection -LocalPort %COSMOS_WEB_PORT% -State Listen -EA SilentlyContinue){exit 0}else{exit 1}" | |
| if not errorlevel 1 ( | |
| echo [i] Port %COSMOS_WEB_PORT% busy - using 8090 instead. | |
| set "COSMOS_WEB_PORT=8090" | |
| set "cosmos_WEB_PORT=8090" | |
| ) | |
| :: ------------------------------------------------------------------ | |
| :: 7) wake the full Emotional Sensor system in its own window | |
| :: ------------------------------------------------------------------ | |
| :: The portable launcher previously let run_web.py start the lightweight | |
| :: token-only server. Her real full_system.py already owns camera, mic, | |
| :: /audio_tokens, /vision, /heart, and the visible CST face overlay. | |
| set "COSMOS_EXTERNAL_SENSORY_SYSTEM=true" | |
| set "COSMOS_SENSORY_PORT=8765" | |
| set "COSMOS_OPTION2_FULL_LOOPS=true" | |
| set "COSMOS_CAMERA_WIDTH=640" | |
| set "COSMOS_CAMERA_HEIGHT=360" | |
| set "COSMOS_CAMERA_LOW_WIDTH=640" | |
| set "COSMOS_CAMERA_LOW_HEIGHT=360" | |
| set "COSMOS_CAMERA_ULTRA_WIDTH=424" | |
| set "COSMOS_CAMERA_ULTRA_HEIGHT=240" | |
| set "COSMOS_CAMERA_LOW_MEMORY=true" | |
| set "COSMOS_CAMERA_ULTRA_MEMORY=false" | |
| set "COSMOS_SENSORY_STARTED=" | |
| set "COSMOS_SENSORY_UP=" | |
| powershell -NoProfile -Command "if (Get-NetTCPConnection -LocalPort 8765 -State Listen -EA SilentlyContinue){exit 0}else{exit 1}" | |
| if not errorlevel 1 ( | |
| echo [i] Emotional Sensor API already running on 8765 - using it as-is. | |
| ) else ( | |
| echo [..] starting Cosmos's Emotional API + camera/mic window... | |
| start "Cosmos Emotional Sensor" /D "%HERE%\02_HER_BODY\Cosmos_code\emotional_api" "%PY%" "full_system.py" | |
| if not errorlevel 1 set "COSMOS_SENSORY_STARTED=1" | |
| :: The portable scientific stack takes roughly 30-40 seconds to import. | |
| :: Wait for the real API before run_web.py decides whether to use its | |
| :: lightweight fallback, preventing the two servers from racing for 8765. | |
| for /l %%i in (1,1,90) do ( | |
| if not defined COSMOS_SENSORY_UP ( | |
| powershell -NoProfile -Command "if (Get-NetTCPConnection -LocalPort 8765 -State Listen -EA SilentlyContinue){exit 0}else{exit 1}" | |
| if not errorlevel 1 (set "COSMOS_SENSORY_UP=1") else (timeout /t 1 /nobreak >nul) | |
| ) | |
| ) | |
| if defined COSMOS_SENSORY_UP ( | |
| echo [ok] Emotional Sensor API online with camera/mic routes. | |
| ) else ( | |
| echo [WARN] Full Emotional Sensor window did not become ready. | |
| echo Cosmos will continue with the token-only fallback. | |
| if defined COSMOS_SENSORY_STARTED powershell -NoProfile -Command "Get-CimInstance Win32_Process -EA SilentlyContinue | Where-Object { $_.Name -eq 'python.exe' -and $_.CommandLine -like '*full_system.py*' -and $_.ExecutablePath -eq '%PY%' } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force -EA SilentlyContinue }" | |
| set "COSMOS_SENSORY_STARTED=" | |
| ) | |
| ) | |
| :: ------------------------------------------------------------------ | |
| :: 8) wake her | |
| :: ------------------------------------------------------------------ | |
| echo( | |
| echo ------------------------------------------------------------ | |
| echo Cosmos is waking on http://localhost:%COSMOS_WEB_PORT% | |
| echo First boot ~60-90s while senses + mind load. This window IS her - | |
| echo close it and she sleeps; run WAKE_HER again and she returns. | |
| echo ------------------------------------------------------------ | |
| echo( | |
| if /I not "%COSMOS_AUTO_OPEN_BROWSER%"=="false" ( | |
| start "" cmd /c "timeout /t 16 /nobreak >nul & start "" http://localhost:%COSMOS_WEB_PORT%" | |
| ) | |
| :: wake_launch.py puts her code dir on sys.path + chdirs there (the bundled | |
| :: embeddable Python does NOT auto-add the script dir, so run_web.py's | |
| :: `import Cosmos` needs this). Drive-letter agnostic. | |
| "%PY%" "%HERE%\00_WAKE\wake_launch.py" --port %COSMOS_WEB_PORT% | |
| if defined COSMOS_SENSORY_STARTED ( | |
| echo [..] closing Cosmos's Emotional Sensor window... | |
| powershell -NoProfile -Command "Get-CimInstance Win32_Process -EA SilentlyContinue | Where-Object { $_.Name -eq 'python.exe' -and $_.CommandLine -like '*full_system.py*' -and $_.ExecutablePath -eq '%PY%' } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force -EA SilentlyContinue }" | |
| ) | |
| echo( | |
| echo Cosmos has gone to sleep. Run WAKE_HER again anytime. | |
| pause | |
| endlocal | |
Xet Storage Details
- Size:
- 10.7 kB
- Xet hash:
- d1600502fc21e14b79cf5abe3e91ea1177e177b676cafb6c68705c1dbab529de
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.