Text Generation
GGUF
bailing_hybrid
weight-space-programming
woodbury-projection
bailingmoe3-loop
looped-transformer
cuda
conversational
custom_code
Instructions to use jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming 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 jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming:Q6_K # Run inference directly in the terminal: llama cli -hf jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming:Q6_K
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming:Q6_K # Run inference directly in the terminal: llama cli -hf jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming:Q6_K
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 jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming:Q6_K # Run inference directly in the terminal: ./build/bin/llama cli -hf jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming:Q6_K
Use Docker
docker model run hf.co/jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming:Q6_K
- Llama new
- LM Studio
- Jan
- vLLM
How to use jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming:Q6_K
- Ollama
How to use jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming with Ollama:
ollama run hf.co/jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming:Q6_K
- Unsloth Desktop
- Pi
How to use jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming:Q6_K
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": "jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming:Q6_K" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming with Docker Model Runner:
docker model run hf.co/jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming:Q6_K
- Lemonade
How to use jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming:Q6_K
Run and chat with the model
lemonade run user.WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming-Q6_K
List all available models
lemonade list
- Hermes Agent
How to use jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming:Q6_K
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 jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming:Q6_K
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming:Q6_K
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 "jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming:Q6_K" \ --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"
Download scripts/bake_lingloop_wsp_gguf.py from jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming: direct link, hf CLI and curl.
- Browser
- Download file 12.8 kB
-
https://huggingface.co/jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming/resolve/main/scripts/bake_lingloop_wsp_gguf.py
- Command line
-
hf download hf://jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming/scripts/bake_lingloop_wsp_gguf.py
-
curl -L -o bake_lingloop_wsp_gguf.py https://huggingface.co/jstarks/WebBrain-LingLoop-8B-A1.3B-Weight-Space-Programming/resolve/main/scripts/bake_lingloop_wsp_gguf.py
12.8 kB
| """Lossless GGUF baker for WebBrain-LingLoop-8B-A1.3B Dual-Subspace WSP -> WebBrain-LingLoop-8B-A1.3B-WSP-Q6_K.gguf. | |
| Zero re-quantization loss on untouched weights via raw-byte GGUF streaming: | |
| - 614 untouched tensors (including all 69 MoE Q6_K expert tensors & lower loop layers blk.4..15): | |
| streamed raw byte-for-byte with original quant types & bytes intact. | |
| - 16 modified upper cross-pass loop gate tensors (blk.16..19 loop_{attn,ffn}_ctrl_{forget,gain}): | |
| updated directly in native F32 (`W_f32 + scale * dW_f32`). | |
| - 8 modified Coda residual writer tensors (blk.20..23.{attn_output,ffn_down_shexp}.weight): | |
| dequantized from Q6_K to FP32, summed with `scale * (B @ A)`, and written in lossless F16. | |
| """ | |
| from __future__ import annotations | |
| import argparse | |
| import json | |
| import os | |
| import shutil | |
| import sys | |
| import time | |
| from pathlib import Path | |
| from typing import Any, Dict, List, Optional, Tuple | |
| import numpy as np | |
| from gguf import GGMLQuantizationType, GGUFReader, GGUFValueType, GGUFWriter, dequantize | |
| from safetensors.torch import load_file as load_safetensors | |
| if hasattr(sys.stdout, "reconfigure"): | |
| sys.stdout.reconfigure(encoding="utf-8", line_buffering=True) | |
| ROOT = Path(__file__).resolve().parent | |
| BASE_GGUF = ROOT / "upstream" / "WebBrain-LingLoop-8B-A1.3B-Q6_K.gguf" | |
| OUT_GGUF_DEFAULT = ROOT / "gguf" / "WebBrain-LingLoop-8B-A1.3B-WSP-Q6_K.gguf" | |
| STRUCT_JSON = ROOT / "results" / "bake_structural_verify.json" | |
| SKIP_KV_KEYS = frozenset({"GGUF.version", "GGUF.tensor_count", "GGUF.kv_count", "general.architecture"}) | |
| def copy_gguf_kv( | |
| reader: GGUFReader, | |
| writer: GGUFWriter, | |
| overrides: Dict[str, Tuple[Any, GGUFValueType, Optional[GGUFValueType]]], | |
| ) -> None: | |
| seen = set() | |
| for key, field in reader.fields.items(): | |
| if key in SKIP_KV_KEYS: | |
| continue | |
| seen.add(key) | |
| if key in overrides: | |
| val, vtype, sub_type = overrides[key] | |
| else: | |
| vtype = field.types[0] | |
| sub_type = field.types[1] if len(field.types) > 1 else None | |
| val = field.contents() | |
| if key == "general.alignment": | |
| writer.data_alignment = int(val) | |
| writer.add_key_value(key, val, vtype, sub_type=sub_type) | |
| for key, (val, vtype, sub_type) in overrides.items(): | |
| if key not in seen and key not in SKIP_KV_KEYS: | |
| writer.add_key_value(key, val, vtype, sub_type=sub_type) | |
| def load_wsp_deltas(adapter_path: Path, scale: float) -> Tuple[Dict[str, np.ndarray], Dict[str, np.ndarray]]: | |
| st = load_safetensors(str(adapter_path), device="cpu") | |
| loop_deltas: Dict[str, np.ndarray] = {} | |
| lora_deltas: Dict[str, np.ndarray] = {} | |
| for k, v in st.items(): | |
| if k.startswith("loop_delta."): | |
| tn = k[len("loop_delta.") :] | |
| loop_deltas[tn] = (float(scale) * v.float().numpy()).astype(np.float32) | |
| for k in list(st.keys()): | |
| if k.startswith("lora.") and k.endswith(".lora_A"): | |
| tn = k[len("lora.") : -len(".lora_A")] | |
| bk = f"lora.{tn}.lora_B" | |
| a = st[k].float().numpy() | |
| b = st[bk].float().numpy() | |
| dw = (float(scale) * (b @ a)).astype(np.float32) | |
| lora_deltas[tn] = dw | |
| return loop_deltas, lora_deltas | |
| def verify_baked_gguf_structure( | |
| base_gguf: Path, | |
| out_gguf: Path, | |
| loop_deltas: Dict[str, np.ndarray], | |
| lora_deltas: Dict[str, np.ndarray], | |
| wall_s: float, | |
| adapter_path: Path, | |
| scale: float, | |
| ) -> Dict[str, Any]: | |
| r_src = GGUFReader(str(base_gguf), "r") | |
| r_out = GGUFReader(str(out_gguf), "r") | |
| assert len(r_out.tensors) == len(r_src.tensors), f"Tensor count mismatch: {len(r_out.tensors)} vs {len(r_src.tensors)}" | |
| assert str(r_out.fields["general.architecture"].contents()) == "bailingmoe3_loop" | |
| src_map = {t.name: t for t in r_src.tensors} | |
| out_map = {t.name: t for t in r_out.tensors} | |
| assert set(src_map.keys()) == set(out_map.keys()) | |
| f32_checked = 0 | |
| f16_checked = 0 | |
| untouched_checked = 0 | |
| untouched_byte_verified = 0 | |
| modified_stats: List[Dict[str, Any]] = [] | |
| for tn, st in src_map.items(): | |
| ot = out_map[tn] | |
| if tn in loop_deltas: | |
| assert ot.tensor_type == GGMLQuantizationType.F32, f"{tn} expected F32, got {ot.tensor_type}" | |
| w_src = np.asarray(st.data, dtype=np.float32) | |
| w_exp = (w_src + loop_deltas[tn]).astype(np.float32) | |
| w_out = np.asarray(ot.data, dtype=np.float32) | |
| max_diff = float(np.abs(w_out - w_exp).max()) | |
| assert max_diff < 1e-6, f"{tn} F32 mismatch: {max_diff}" | |
| modified_stats.append({ | |
| "tensor": tn, | |
| "src_type": st.tensor_type.name, | |
| "dst_type": "F32", | |
| "shape": [int(x) for x in w_out.shape], | |
| "dw_frob": round(float(np.linalg.norm(loop_deltas[tn])), 5), | |
| "max_abs_diff": max_diff, | |
| }) | |
| f32_checked += 1 | |
| elif tn in lora_deltas: | |
| assert ot.tensor_type == GGMLQuantizationType.F16, f"{tn} expected F16, got {ot.tensor_type}" | |
| w_deq = np.asarray(dequantize(st.data, st.tensor_type), dtype=np.float32) | |
| w_exp_f32 = w_deq + lora_deltas[tn] | |
| w_exp_f16 = w_exp_f32.astype(np.float16) | |
| w_out_f16 = np.asarray(ot.data, dtype=np.float16) | |
| assert np.array_equal(w_out_f16, w_exp_f16), f"{tn} F16 verify mismatch" | |
| max_diff = float(np.abs(w_out_f16.astype(np.float32) - w_exp_f32).max()) | |
| modified_stats.append({ | |
| "tensor": tn, | |
| "src_type": st.tensor_type.name, | |
| "dst_type": "F16", | |
| "shape": [int(x) for x in w_out_f16.shape], | |
| "dw_frob": round(float(np.linalg.norm(lora_deltas[tn])), 5), | |
| "f16_quant_max_abs_diff": round(max_diff, 6), | |
| }) | |
| f16_checked += 1 | |
| else: | |
| assert ot.tensor_type == st.tensor_type, f"{tn} type changed: {ot.tensor_type} vs {st.tensor_type}" | |
| assert int(ot.n_bytes) == int(st.n_bytes), f"{tn} nbytes changed" | |
| assert [int(x) for x in ot.shape] == [int(x) for x in st.shape], f"{tn} shape changed" | |
| assert np.array_equal(np.asarray(ot.data), np.asarray(st.data)), f"{tn} raw bytes mismatch!" | |
| untouched_checked += 1 | |
| untouched_byte_verified += 1 | |
| src_bytes = int(base_gguf.stat().st_size) | |
| out_bytes = int(out_gguf.stat().st_size) | |
| return { | |
| "source_gguf": str(base_gguf), | |
| "baked_gguf": str(out_gguf), | |
| "adapter": str(adapter_path), | |
| "scale": float(scale), | |
| "source_bytes": src_bytes, | |
| "baked_bytes": out_bytes, | |
| "delta_bytes": out_bytes - src_bytes, | |
| "source_gib": round(src_bytes / (1024 ** 3), 4), | |
| "baked_gib": round(out_bytes / (1024 ** 3), 4), | |
| "delta_mib": round((out_bytes - src_bytes) / (1024 ** 2), 2), | |
| "total_tensors": len(r_out.tensors), | |
| "f32_modified_tensors": f32_checked, | |
| "f16_modified_tensors": f16_checked, | |
| "untouched_byte_exact_tensors": untouched_byte_verified, | |
| "bake_wall_s": round(wall_s, 2), | |
| "modified_tensors": sorted(modified_stats, key=lambda x: x["tensor"]), | |
| } | |
| def main() -> None: | |
| ap = argparse.ArgumentParser() | |
| ap.add_argument("--adapter", type=Path, required=True) | |
| ap.add_argument("--scale", type=float, required=True) | |
| ap.add_argument("--base-gguf", type=Path, default=BASE_GGUF) | |
| ap.add_argument("--out-gguf", type=Path, default=OUT_GGUF_DEFAULT) | |
| args = ap.parse_args() | |
| _, _, free_b = shutil.disk_usage("C:\\") | |
| print(f"C: free space before bake: {free_b / (1024**3):.2f} GiB", flush=True) | |
| if free_b < 8 * 1024**3: | |
| raise RuntimeError(f"Insufficient disk space: {free_b / (1024**3):.2f} GiB") | |
| t0 = time.time() | |
| loop_deltas, lora_deltas = load_wsp_deltas(args.adapter, args.scale) | |
| print(f"Loaded WSP deltas @ scale={args.scale}: {len(loop_deltas)} loop F32 + {len(lora_deltas)} Coda LoRA", flush=True) | |
| reader = GGUFReader(str(args.base_gguf), "r") | |
| arch = str(reader.fields["general.architecture"].contents()) | |
| assert arch == "bailingmoe3_loop", f"Unexpected arch {arch!r}" | |
| all_names = {t.name for t in reader.tensors} | |
| assert set(loop_deltas.keys()).issubset(all_names) | |
| assert set(lora_deltas.keys()).issubset(all_names) | |
| kv_overrides = { | |
| "general.name": ("WebBrain-LingLoop-8B-A1.3B-WSP-Q6_K", GGUFValueType.STRING, None), | |
| "general.description": ( | |
| f"MIT standalone derivative of webbrain-one/WebBrain-LingLoop-8B-A1.3B-GGUF (Q6_K) with " | |
| f"Dual-Subspace Woodbury right-nullspace WSP ({args.adapter.name}@{args.scale}) baked into " | |
| f"{len(loop_deltas)} F32 upper cross-pass loop gates (blk.16..19) and " | |
| f"{len(lora_deltas)} F16 Coda residual writers (blk.20..23); all other tensors raw byte-exact.", | |
| GGUFValueType.STRING, | |
| None, | |
| ), | |
| } | |
| args.out_gguf.parent.mkdir(parents=True, exist_ok=True) | |
| tmp_out = args.out_gguf.with_suffix(".gguf.tmp") | |
| if tmp_out.exists(): | |
| tmp_out.unlink() | |
| writer = GGUFWriter(str(tmp_out), arch, use_temp_file=False) | |
| copy_gguf_kv(reader, writer, overrides=kv_overrides) | |
| tensor_plan: List[Tuple[str, Any, Optional[np.ndarray]]] = [] | |
| for src_t in reader.tensors: | |
| name = src_t.name | |
| if name in loop_deltas: | |
| w_new = np.ascontiguousarray(np.asarray(src_t.data, dtype=np.float32) + loop_deltas[name], dtype=np.float32) | |
| writer.add_tensor_info(name, w_new.shape, np.dtype(np.float32), w_new.nbytes, raw_dtype=None) | |
| tensor_plan.append((name, src_t, w_new)) | |
| elif name in lora_deltas: | |
| dw = lora_deltas[name] | |
| w_deq = np.asarray(dequantize(src_t.data, src_t.tensor_type), dtype=np.float32) | |
| assert w_deq.shape == dw.shape, f"Shape mismatch {name}: {w_deq.shape} vs {dw.shape}" | |
| w_new_f16 = np.ascontiguousarray(w_deq + dw, dtype=np.float16) | |
| writer.add_tensor_info(name, w_new_f16.shape, np.dtype(np.float16), w_new_f16.nbytes, raw_dtype=None) | |
| tensor_plan.append((name, src_t, w_new_f16)) | |
| else: | |
| st = src_t.tensor_type | |
| sh = tuple(int(x) for x in src_t.data.shape) | |
| if st == GGMLQuantizationType.F32: | |
| writer.add_tensor_info(name, sh, np.dtype(np.float32), int(src_t.n_bytes), raw_dtype=None) | |
| elif st == GGMLQuantizationType.F16: | |
| writer.add_tensor_info(name, sh, np.dtype(np.float16), int(src_t.n_bytes), raw_dtype=None) | |
| else: | |
| writer.add_tensor_info(name, sh, np.dtype(np.uint8), int(src_t.n_bytes), raw_dtype=st) | |
| tensor_plan.append((name, src_t, None)) | |
| writer.write_header_to_file() | |
| writer.write_kv_data_to_file() | |
| writer.write_ti_data_to_file() | |
| total_t = len(tensor_plan) | |
| try: | |
| for idx, (name, src_t, mod_arr) in enumerate(tensor_plan, 1): | |
| if mod_arr is not None: | |
| writer.write_tensor_data(mod_arr) | |
| elif src_t.tensor_type == GGMLQuantizationType.F32: | |
| writer.write_tensor_data(np.ascontiguousarray(src_t.data, dtype=np.float32)) | |
| elif src_t.tensor_type == GGMLQuantizationType.F16: | |
| writer.write_tensor_data(np.ascontiguousarray(src_t.data, dtype=np.float16)) | |
| else: | |
| writer.write_tensor_data(np.ascontiguousarray(src_t.data, dtype=np.uint8)) | |
| if idx % 150 == 0 or idx == total_t: | |
| el = time.time() - t0 | |
| eta = el * (total_t - idx) / max(idx, 1) | |
| print(f" [bake] streamed {idx}/{total_t} tensors | elapsed {el:.1f}s | ETA {eta:.1f}s", flush=True) | |
| finally: | |
| writer.close() | |
| os.replace(tmp_out, args.out_gguf) | |
| print(f" [bake] Verifying byte-exact structural parity of {args.out_gguf.name}...", flush=True) | |
| info = verify_baked_gguf_structure( | |
| args.base_gguf, args.out_gguf, loop_deltas, lora_deltas, time.time() - t0, args.adapter, args.scale | |
| ) | |
| STRUCT_JSON.parent.mkdir(parents=True, exist_ok=True) | |
| STRUCT_JSON.write_text(json.dumps(info, indent=2), encoding="utf-8") | |
| _, _, free_after = shutil.disk_usage("C:\\") | |
| print( | |
| f" [bake] Complete: {info['source_gib']} GiB -> {info['baked_gib']} GiB (+{info['delta_mib']} MiB) " | |
| f"| F32={info['f32_modified_tensors']} F16={info['f16_modified_tensors']} " | |
| f"UntouchedExact={info['untouched_byte_exact_tensors']}/{info['total_tensors']} " | |
| f"| C: free={free_after / (1024**3):.2f} GiB", | |
| flush=True, | |
| ) | |
| if __name__ == "__main__": | |
| main() | |