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
File size: 2,712 Bytes
fc32096 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | 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))
|