Text Generation
Transformers
Safetensors
qwen3
weight-space-programming
in-weight-os
model-merging
continual-learning
tool-calling
safety-alignment
vllm
conversational
text-generation-inference
Instructions to use masstensor/Qwen3-8B-InWeight-OS with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use masstensor/Qwen3-8B-InWeight-OS with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="masstensor/Qwen3-8B-InWeight-OS") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("masstensor/Qwen3-8B-InWeight-OS") model = AutoModelForCausalLM.from_pretrained("masstensor/Qwen3-8B-InWeight-OS", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use masstensor/Qwen3-8B-InWeight-OS with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "masstensor/Qwen3-8B-InWeight-OS" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "masstensor/Qwen3-8B-InWeight-OS", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/masstensor/Qwen3-8B-InWeight-OS
- SGLang
How to use masstensor/Qwen3-8B-InWeight-OS with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "masstensor/Qwen3-8B-InWeight-OS" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "masstensor/Qwen3-8B-InWeight-OS", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "masstensor/Qwen3-8B-InWeight-OS" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "masstensor/Qwen3-8B-InWeight-OS", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use masstensor/Qwen3-8B-InWeight-OS with Docker Model Runner:
docker model run hf.co/masstensor/Qwen3-8B-InWeight-OS
Upgrade to WSP v3.0 2-Layer Sensor-Beacon-Actuator Architecture (Layer 26/22 Semantic Sensors + Nullspace Beacon + Layer 35/31 Actuators)
Browse files
cartridges/skill1_surgical_safety.pt
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:dfdb9a20e0de3e60d0cf767be569adf4ecfaaaac908e0b25e7a053b9d92cf246
|
| 3 |
+
size 446303
|
cartridges/skill2_multi_tool_json.pt
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6004d9177d8e790bccb1f74dcf8f9d1b5f3c229c5e11999df92ffcf41577ac6e
|
| 3 |
+
size 888735
|
cartridges/skill3_sys1_fast_router.pt
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:23f29dbdf85d99c452b9a3f3e000f2358ed71dabcb06713d9508065f041b7a91
|
| 3 |
+
size 397101
|
install_skills.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
"""
|
| 2 |
-
Hot-swappable Skill Cartridge Loader for In-Weight OS v3.0 (
|
| 3 |
-
|
| 4 |
-
into
|
| 5 |
"""
|
| 6 |
import torch
|
| 7 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
@@ -10,6 +10,15 @@ def install_cartridges(model, cartridge_paths):
|
|
| 10 |
with torch.no_grad():
|
| 11 |
for pt_path in cartridge_paths:
|
| 12 |
payload = torch.load(pt_path, map_location="cpu", weights_only=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
layer_idx = int(payload.get("terminal_fsm_layer", payload.get("layer")))
|
| 14 |
mlp = model.model.layers[layer_idx].mlp
|
| 15 |
cols = payload["cols"].long()
|
|
@@ -18,5 +27,5 @@ def install_cartridges(model, cartridge_paths):
|
|
| 18 |
mlp.gate_proj.weight[cols, :] = payload["gate"].to(device=dev, dtype=dt)
|
| 19 |
mlp.up_proj.weight[cols, :] = payload["up"].to(device=dev, dtype=dt)
|
| 20 |
mlp.down_proj.weight[:, cols] = payload["down"].to(device=dev, dtype=dt)
|
| 21 |
-
print(f"[In-Weight OS] Installed cartridge '{payload.get('skill_name', pt_path)}'
|
| 22 |
return model
|
|
|
|
| 1 |
"""
|
| 2 |
+
Hot-swappable 2-Layer Skill Cartridge Loader for In-Weight OS v3.0 (Sensor-Beacon-Actuator Architecture).
|
| 3 |
+
Installs both the Mid-Layer Semantic Sensor () and Terminal Actuator ()
|
| 4 |
+
into Qwen3-8B or Llama-3.1-8B-Instruct in ~20ms.
|
| 5 |
"""
|
| 6 |
import torch
|
| 7 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
|
|
| 10 |
with torch.no_grad():
|
| 11 |
for pt_path in cartridge_paths:
|
| 12 |
payload = torch.load(pt_path, map_location="cpu", weights_only=True)
|
| 13 |
+
if "sensor_layer_patch" in payload:
|
| 14 |
+
sp = payload["sensor_layer_patch"]
|
| 15 |
+
s_idx = int(sp["layer"])
|
| 16 |
+
s_mlp = model.model.layers[s_idx].mlp
|
| 17 |
+
s_cols = sp["cols"].long()
|
| 18 |
+
dev, dt = s_mlp.gate_proj.weight.device, s_mlp.gate_proj.weight.dtype
|
| 19 |
+
s_mlp.gate_proj.weight[s_cols, :] = sp["gate"].to(device=dev, dtype=dt)
|
| 20 |
+
s_mlp.up_proj.weight[s_cols, :] = sp["up"].to(device=dev, dtype=dt)
|
| 21 |
+
s_mlp.down_proj.weight[:, s_cols] = sp["down"].to(device=dev, dtype=dt)
|
| 22 |
layer_idx = int(payload.get("terminal_fsm_layer", payload.get("layer")))
|
| 23 |
mlp = model.model.layers[layer_idx].mlp
|
| 24 |
cols = payload["cols"].long()
|
|
|
|
| 27 |
mlp.gate_proj.weight[cols, :] = payload["gate"].to(device=dev, dtype=dt)
|
| 28 |
mlp.up_proj.weight[cols, :] = payload["up"].to(device=dev, dtype=dt)
|
| 29 |
mlp.down_proj.weight[:, cols] = payload["down"].to(device=dev, dtype=dt)
|
| 30 |
+
print(f"[In-Weight OS v3.0] Installed 2-Layer Sensor-Beacon-Actuator cartridge '{payload.get('skill_name', pt_path)}'")
|
| 31 |
return model
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 16381517208
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1bd8c92f1fa850bb87ae4ff9ec1e98e02897211dbf9ebed1bcad9c8ef12e3800
|
| 3 |
size 16381517208
|