Text Generation
Transformers
Safetensors
English
Russian
qwen3_5
image-text-to-text
weight-space-programming
wspforge
math
experimental
conversational
Instructions to use end000/Qwen3.5-0.8B-WSPForge-Math-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use end000/Qwen3.5-0.8B-WSPForge-Math-v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="end000/Qwen3.5-0.8B-WSPForge-Math-v1") 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("end000/Qwen3.5-0.8B-WSPForge-Math-v1") model = AutoModelForMultimodalLM.from_pretrained("end000/Qwen3.5-0.8B-WSPForge-Math-v1", 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
- vLLM
How to use end000/Qwen3.5-0.8B-WSPForge-Math-v1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "end000/Qwen3.5-0.8B-WSPForge-Math-v1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "end000/Qwen3.5-0.8B-WSPForge-Math-v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/end000/Qwen3.5-0.8B-WSPForge-Math-v1
- SGLang
How to use end000/Qwen3.5-0.8B-WSPForge-Math-v1 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 "end000/Qwen3.5-0.8B-WSPForge-Math-v1" \ --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": "end000/Qwen3.5-0.8B-WSPForge-Math-v1", "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 "end000/Qwen3.5-0.8B-WSPForge-Math-v1" \ --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": "end000/Qwen3.5-0.8B-WSPForge-Math-v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use end000/Qwen3.5-0.8B-WSPForge-Math-v1 with Docker Model Runner:
docker model run hf.co/end000/Qwen3.5-0.8B-WSPForge-Math-v1
Download wspforge/research_code/src/analyze.py from end000/Qwen3.5-0.8B-WSPForge-Math-v1: direct link, hf CLI and curl.
- Browser
- Download file 2.71 kB
-
https://huggingface.co/end000/Qwen3.5-0.8B-WSPForge-Math-v1/resolve/main/wspforge/research_code/src/analyze.py
- Command line
-
hf download hf://end000/Qwen3.5-0.8B-WSPForge-Math-v1/wspforge/research_code/src/analyze.py
-
curl -L -o analyze.py https://huggingface.co/end000/Qwen3.5-0.8B-WSPForge-Math-v1/resolve/main/wspforge/research_code/src/analyze.py
2.71 kB
| import argparse | |
| import json | |
| import numpy as np | |
| import torch | |
| from common import inside, save_json, permit_compute | |
| from weights import load, project_writers, save_edit | |
| def matched_direction(productive, repetitive): | |
| a, b = np.asarray(productive), np.asarray(repetitive) | |
| if a.shape != b.shape or a.ndim != 2: | |
| raise ValueError('Нужны попарные средние активации одинаковой формы [contexts, width]') | |
| direction = (b - a).mean(0) | |
| norm = np.linalg.norm(direction) | |
| if not np.isfinite(norm) or norm == 0: | |
| raise ValueError('Направление не определено') | |
| return direction / norm | |
| def writer_scores(weight, direction, productive_mlp, repetitive_mlp): | |
| coefficients = np.asarray(direction) @ weight.float().numpy() | |
| deltas = np.asarray(repetitive_mlp) - np.asarray(productive_mlp) | |
| values = deltas * coefficients | |
| return values.mean(0), (values > 0).mean(0) | |
| if __name__ == '__main__': | |
| p = argparse.ArgumentParser() | |
| p.add_argument('--model', required=True) | |
| p.add_argument('--tensor', required=True) | |
| p.add_argument('--productive', required=True) | |
| p.add_argument('--repetitive', required=True) | |
| p.add_argument('--productive-mlp', required=True) | |
| p.add_argument('--repetitive-mlp', required=True) | |
| p.add_argument('--columns', type=int, required=True) | |
| p.add_argument('--alpha', type=float, required=True) | |
| p.add_argument('--out', required=True) | |
| p.add_argument('--hypothesis', required=True) | |
| a = p.parse_args() | |
| permit_compute() | |
| direction = matched_direction(np.load(inside(a.productive)), np.load(inside(a.repetitive))) | |
| weight = load(a.model, a.tensor) | |
| score, consistency = writer_scores(weight, direction, np.load(inside(a.productive_mlp)), np.load(inside(a.repetitive_mlp))) | |
| if not 1 <= a.columns < weight.shape[1]: | |
| raise ValueError('Неверное количество столбцов') | |
| columns = np.argsort(score)[-a.columns:] | |
| edited = project_writers(weight, direction, columns, a.alpha) | |
| record = save_edit(a.model, a.out, a.tensor, edited, a.hypothesis) | |
| save_json(inside(a.out) / (a.tensor + '.analysis.json'), {'columns': columns.tolist(), 'alpha': a.alpha, | |
| 'scores': score[columns].tolist(), | |
| 'consistency': consistency[columns].tolist(), | |
| 'input_files': [a.productive, a.repetitive, a.productive_mlp, a.repetitive_mlp]}) | |
| np.save(inside(a.out) / (a.tensor + '.direction.npy'), direction) | |
| print(json.dumps(record, ensure_ascii=False)) | |