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
Download install_skills.py from masstensor/Qwen3-8B-InWeight-OS: direct link, hf CLI and curl.
- Browser
- Download file 1.8 kB
-
https://huggingface.co/masstensor/Qwen3-8B-InWeight-OS/resolve/main/install_skills.py
- Command line
-
hf download hf://masstensor/Qwen3-8B-InWeight-OS/install_skills.py
-
curl -L -o install_skills.py https://huggingface.co/masstensor/Qwen3-8B-InWeight-OS/resolve/main/install_skills.py
1.8 kB
| """ | |
| Hot-swappable 2-Layer Skill Cartridge Loader for In-Weight OS v3.0 (Sensor-Beacon-Actuator Architecture). | |
| Installs both the Mid-Layer Semantic Sensor (`sensor_layer_patch`) and Terminal Actuator (`terminal_fsm_layer`) | |
| into Qwen3-8B or Llama-3.1-8B-Instruct in ~20ms. | |
| """ | |
| import torch | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| def install_cartridges(model, cartridge_paths): | |
| with torch.no_grad(): | |
| for pt_path in cartridge_paths: | |
| payload = torch.load(pt_path, map_location="cpu", weights_only=True) | |
| if "sensor_layer_patch" in payload: | |
| sp = payload["sensor_layer_patch"] | |
| s_idx = int(sp["layer"]) | |
| s_mlp = model.model.layers[s_idx].mlp | |
| s_cols = sp["cols"].long() | |
| dev, dt = s_mlp.gate_proj.weight.device, s_mlp.gate_proj.weight.dtype | |
| s_mlp.gate_proj.weight[s_cols, :] = sp["gate"].to(device=dev, dtype=dt) | |
| s_mlp.up_proj.weight[s_cols, :] = sp["up"].to(device=dev, dtype=dt) | |
| s_mlp.down_proj.weight[:, s_cols] = sp["down"].to(device=dev, dtype=dt) | |
| layer_idx = int(payload.get("terminal_fsm_layer", payload.get("layer"))) | |
| mlp = model.model.layers[layer_idx].mlp | |
| cols = payload["cols"].long() | |
| dev = mlp.gate_proj.weight.device | |
| dt = mlp.gate_proj.weight.dtype | |
| mlp.gate_proj.weight[cols, :] = payload["gate"].to(device=dev, dtype=dt) | |
| mlp.up_proj.weight[cols, :] = payload["up"].to(device=dev, dtype=dt) | |
| mlp.down_proj.weight[:, cols] = payload["down"].to(device=dev, dtype=dt) | |
| print(f"[In-Weight OS v3.0] Installed 2-Layer Sensor-Beacon-Actuator cartridge '{payload.get('skill_name', pt_path)}'") | |
| return model | |