Download sail_scripts/kernel/build_kernel.sh from muterornament/sail: direct link, hf CLI and curl.
- Browser
- Download file 3.64 kB
-
https://huggingface.co/muterornament/sail/resolve/main/sail_scripts/kernel/build_kernel.sh
- Command line
-
hf download hf://muterornament/sail/sail_scripts/kernel/build_kernel.sh
-
curl -L -o build_kernel.sh https://huggingface.co/muterornament/sail/resolve/main/sail_scripts/kernel/build_kernel.sh
3.64 kB
| # ============================================================ | |
| # SAIL Kernel β Build Script | |
| # Compiles the Rust kernel and installs it into system Python. | |
| # Run from WSL: bash sail/kernel/build_kernel.sh | |
| # ============================================================ | |
| set -e # Exit immediately on any error | |
| KERNEL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | |
| WHEEL_DIR="$KERNEL_DIR/target/wheels" | |
| echo "============================================" | |
| echo " SAIL Memory-Safe Rust Kernel β Build" | |
| echo "============================================" | |
| echo "" | |
| # ββ Check dependencies ββββββββββββββββββββββββββββββββββββββββ | |
| echo "[1/4] Checking dependencies..." | |
| if ! command -v cargo &>/dev/null; then | |
| echo " β cargo not found. Loading rustup environment..." | |
| source "$HOME/.cargo/env" 2>/dev/null || { | |
| echo " β Rust not installed. Run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash" | |
| exit 1 | |
| } | |
| fi | |
| RUST_VER=$(rustc --version) | |
| echo " β Rust: $RUST_VER" | |
| if ! /mnt/e/agent/agent_ai/sail/ai_env/bin/python -m maturin --version &>/dev/null; then | |
| echo " Installing maturin in ai_env..." | |
| /mnt/e/agent/agent_ai/sail/ai_env/bin/python -m pip install maturin pyarrow zstandard --quiet | |
| fi | |
| MATURIN_VER=$(/mnt/e/agent/agent_ai/sail/ai_env/bin/python -m maturin --version) | |
| echo " β maturin: $MATURIN_VER" | |
| # ββ Build release wheel βββββββββββββββββββββββββββββββββββββββ | |
| echo "" | |
| echo "[2/4] Building release wheel..." | |
| cd "$KERNEL_DIR" | |
| VIRTUAL_ENV='/mnt/e/agent/agent_ai/sail/ai_env' PYO3_PYTHON=/mnt/e/agent/agent_ai/sail/ai_env/bin/python /mnt/e/agent/agent_ai/sail/ai_env/bin/python -m maturin build --release 2>&1 | |
| # ββ Find wheel ββββββββββββββββββββββββββββββββββββββββββββββββ | |
| echo "" | |
| echo "[3/4] Locating wheel..." | |
| WHEEL=$(ls "$WHEEL_DIR"/sail_kernel-*.whl 2>/dev/null | head -1) | |
| if [ -z "$WHEEL" ]; then | |
| echo " β No wheel found in $WHEEL_DIR" | |
| exit 1 | |
| fi | |
| echo " β Wheel: $(basename $WHEEL)" | |
| # ββ Install wheel βββββββββββββββββββββββββββββββββββββββββββββ | |
| echo "" | |
| echo "[4/4] Installing into ai_env Python..." | |
| source /mnt/e/agent/agent_ai/sail/ai_env/bin/activate | |
| /mnt/e/agent/agent_ai/sail/ai_env/bin/python -m pip install "$WHEEL" --force-reinstall --quiet | |
| echo " β Installed sail_kernel in ai_env" | |
| # ββ Quick smoke test ββββββββββββββββββββββββββββββββββββββββββ | |
| echo "" | |
| echo "ββ Smoke Test βββββββββββββββββββββββββββββββ" | |
| python -c " | |
| import sail_kernel | |
| print(' version:', sail_kernel.__version__) | |
| print(' clean_text OK:', sail_kernel.clean_text('<b>Hello</b>')) | |
| print(' token_budget(2 marks):', sail_kernel.compute_budget('Define X. [2 marks]')) | |
| print(' token_budget(8 marks):', sail_kernel.compute_budget('Explain Y (8 marks)')) | |
| score = sail_kernel.score_output('## Ans\n\n**Key**: text\n\n- item 1', 300) | |
| print(' reward_scorer total:', round(score.total_score, 3)) | |
| print() | |
| print(' All tests PASSED! β') | |
| " | |
| echo "" | |
| echo "============================================" | |
| echo " SAIL Kernel built and ready." | |
| echo " Import with: import sail_kernel" | |
| echo "============================================" | |