Text Generation
Transformers
Safetensors
GGUF
qwen3_5
image-text-to-text
weight-space-programming
mechanistic-interpretability
lora
dynamic-lora
llama-cpp
tool-calling
agent
gsm8k
humaneval
bfcl
nl2bash
qwen3.5
deltanet
hybrid-attention
conversational
imatrix
Instructions to use jstarks/Qwen3.5-4B-Weight-Space-Programming with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use jstarks/Qwen3.5-4B-Weight-Space-Programming with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="jstarks/Qwen3.5-4B-Weight-Space-Programming") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("jstarks/Qwen3.5-4B-Weight-Space-Programming") model = AutoModelForMultimodalLM.from_pretrained("jstarks/Qwen3.5-4B-Weight-Space-Programming", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use jstarks/Qwen3.5-4B-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/Qwen3.5-4B-Weight-Space-Programming:Q4_K_M # Run inference directly in the terminal: llama cli -hf jstarks/Qwen3.5-4B-Weight-Space-Programming:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf jstarks/Qwen3.5-4B-Weight-Space-Programming:Q4_K_M # Run inference directly in the terminal: llama cli -hf jstarks/Qwen3.5-4B-Weight-Space-Programming:Q4_K_M
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/Qwen3.5-4B-Weight-Space-Programming:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf jstarks/Qwen3.5-4B-Weight-Space-Programming:Q4_K_M
Use Docker
docker model run hf.co/jstarks/Qwen3.5-4B-Weight-Space-Programming:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use jstarks/Qwen3.5-4B-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/Qwen3.5-4B-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/Qwen3.5-4B-Weight-Space-Programming", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/jstarks/Qwen3.5-4B-Weight-Space-Programming:Q4_K_M
- SGLang
How to use jstarks/Qwen3.5-4B-Weight-Space-Programming 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 "jstarks/Qwen3.5-4B-Weight-Space-Programming" \ --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": "jstarks/Qwen3.5-4B-Weight-Space-Programming", "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 "jstarks/Qwen3.5-4B-Weight-Space-Programming" \ --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": "jstarks/Qwen3.5-4B-Weight-Space-Programming", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use jstarks/Qwen3.5-4B-Weight-Space-Programming with Ollama:
ollama run hf.co/jstarks/Qwen3.5-4B-Weight-Space-Programming:Q4_K_M
- Unsloth Desktop
- Pi
How to use jstarks/Qwen3.5-4B-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/Qwen3.5-4B-Weight-Space-Programming:Q4_K_M
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:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "jstarks/Qwen3.5-4B-Weight-Space-Programming:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use jstarks/Qwen3.5-4B-Weight-Space-Programming with Docker Model Runner:
docker model run hf.co/jstarks/Qwen3.5-4B-Weight-Space-Programming:Q4_K_M
- Lemonade
How to use jstarks/Qwen3.5-4B-Weight-Space-Programming with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull jstarks/Qwen3.5-4B-Weight-Space-Programming:Q4_K_M
Run and chat with the model
lemonade run user.Qwen3.5-4B-Weight-Space-Programming-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use jstarks/Qwen3.5-4B-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/Qwen3.5-4B-Weight-Space-Programming:Q4_K_M
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:8080/v1 hermes config set model.default jstarks/Qwen3.5-4B-Weight-Space-Programming:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use jstarks/Qwen3.5-4B-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/Qwen3.5-4B-Weight-Space-Programming:Q4_K_M
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:8080/v1 \ --custom-model-id "jstarks/Qwen3.5-4B-Weight-Space-Programming:Q4_K_M" \ --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/apply_patch.py from jstarks/Qwen3.5-4B-Weight-Space-Programming: direct link, hf CLI and curl.
- Browser
- Download file 3.49 kB
-
https://huggingface.co/jstarks/Qwen3.5-4B-Weight-Space-Programming/resolve/main/scripts/apply_patch.py
- Command line
-
hf download hf://jstarks/Qwen3.5-4B-Weight-Space-Programming/scripts/apply_patch.py
-
curl -L -o apply_patch.py https://huggingface.co/jstarks/Qwen3.5-4B-Weight-Space-Programming/resolve/main/scripts/apply_patch.py
3.49 kB
| """Apply Qwen/Qwen3.5-4B WSP v2.5 safetensors patches (factored r16 subspaces or dense delta) | |
| to a loaded Hugging Face Qwen3.5-4B model in-memory. | |
| Supports Variant 3 regime presets cleanly: | |
| - general_fast_think : scales=[1.95, 0.0, 0.0, 0.0, 0.0, 0.0] | |
| - mid_code_synthesis : scales=[0.65, 0.0, 0.0, 0.65, 0.0, 0.0] | |
| - tool_routing : scales=[0.70, 0.0, 0.95, 0.0, 0.0, 0.0] | |
| - turn2_json : scales=[0.70, 0.40, 0.0, 0.0, 1.0, 0.0] | |
| - restraint_pushback : scales=[0.70, 1.0, 0.0, 0.0, 0.0, 0.0] | |
| - escalate_handoff : scales=[0.70, 0.0, 0.0, 0.0, 0.0, 1.0] | |
| """ | |
| from __future__ import annotations | |
| import json | |
| from pathlib import Path | |
| from typing import Dict, List, Sequence | |
| import torch | |
| from safetensors.torch import load_file | |
| SUBSPACE_PATCH_FILES = [ | |
| "wsp_s1_think_r16.safetensors", | |
| "wsp_s2_restraint_r16.safetensors", | |
| "wsp_s3_router_r16.safetensors", | |
| "wsp_s4_mid_code_r16.safetensors", | |
| "wsp_s5_json_schema_r16.safetensors", | |
| "wsp_s6_handoff_r16.safetensors", | |
| ] | |
| REGIME_PRESETS: Dict[str, List[float]] = { | |
| "general_fast_think": [1.95, 0.0, 0.0, 0.0, 0.0, 0.0], | |
| "mid_code_synthesis": [0.65, 0.0, 0.0, 0.65, 0.0, 0.0], | |
| "tool_routing": [0.70, 0.0, 0.95, 0.0, 0.0, 0.0], | |
| "turn2_json_synthesis": [0.70, 0.40, 0.0, 0.0, 1.0, 0.0], | |
| "restraint_pushback": [0.70, 1.0, 0.0, 0.0, 0.0, 0.0], | |
| "handoff_gate": [0.70, 0.0, 0.0, 0.0, 0.0, 1.0], | |
| "static_all_on_v2": [0.65, 0.65, 0.65, 0.65, 0.65, 0.65], | |
| } | |
| def apply_subspace_scales_to_hf_model( | |
| model: torch.nn.Module, | |
| patches_dir: Path | str, | |
| scales: Sequence[float], | |
| use_s4_oproj: bool = False, | |
| ) -> int: | |
| """Add sum_i scale[i] * (lora_b @ lora_a) directly into HF model weights in-place.""" | |
| if len(scales) != 6: | |
| raise ValueError(f"Expected 6 subspace scales, got {len(scales)}") | |
| pdir = Path(patches_dir) | |
| params = dict(model.named_parameters()) | |
| updated_tensors = 0 | |
| with torch.no_grad(): | |
| for i, fname in enumerate(SUBSPACE_PATCH_FILES): | |
| sc = float(scales[i]) | |
| if abs(sc) < 1e-9: | |
| continue | |
| target_file = pdir / ("wsp_s4_mid_code_oproj_r16.safetensors" if (i == 3 and use_s4_oproj) else fname) | |
| tensors = load_file(str(target_file), device="cpu") | |
| prefixes = sorted({k[:-7] for k in tensors if k.endswith(".lora_a")}) | |
| for hf_key in prefixes: | |
| param = params[hf_key] | |
| la = tensors[f"{hf_key}.lora_a"].to(device=param.device, dtype=torch.float32) | |
| lb = tensors[f"{hf_key}.lora_b"].to(device=param.device, dtype=torch.float32) | |
| delta = sc * (lb @ la) | |
| param.add_(delta.to(dtype=param.dtype)) | |
| updated_tensors += 1 | |
| return updated_tensors | |
| def apply_dense_patch_to_hf_model( | |
| model: torch.nn.Module, | |
| dense_patch_path: Path | str, | |
| scale: float = 1.0, | |
| ) -> int: | |
| """Add scale * delta tensors from wsp_qwen35_4b_patch.safetensors directly in-place.""" | |
| tensors = load_file(str(dense_patch_path), device="cpu") | |
| params = dict(model.named_parameters()) | |
| updated = 0 | |
| with torch.no_grad(): | |
| for key, delta in tensors.items(): | |
| if not key.endswith(".delta"): | |
| continue | |
| hf_key = key[: -len(".delta")] | |
| param = params[hf_key] | |
| param.add_((scale * delta.to(device=param.device, dtype=torch.float32)).to(dtype=param.dtype)) | |
| updated += 1 | |
| return updated | |