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: 4,135 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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | import argparse
import base64
import hashlib
import json
from pathlib import Path
import shutil
import struct
import numpy as np
def file_hash(path):
with path.open('rb') as stream:
return hashlib.file_digest(stream, 'sha256').hexdigest()
def apply_patch(original, manifest_path, patch_path, output):
original, manifest_path, patch_path, output = map(Path, (original, manifest_path, patch_path, output))
if output.exists() or output.resolve() == original.resolve():
raise ValueError('Output must be a new file; original weights are never overwritten')
manifest = json.loads(manifest_path.read_text())
if file_hash(original) != manifest['original_sha256'] or file_hash(patch_path) != manifest['patch_sha256']:
raise ValueError('Original checkpoint or patch checksum differs')
with original.open('rb') as stream:
original_length = struct.unpack('<Q', stream.read(8))[0]
original_header = json.loads(stream.read(original_length))
target_header_bytes = base64.b64decode(manifest['target_header_base64'], validate=True)
target_header = json.loads(target_header_bytes)
if {k: v for k, v in original_header.items() if k != '__metadata__'} != {
k: v for k, v in target_header.items() if k != '__metadata__'}:
raise ValueError('Tensor layouts differ')
output.parent.mkdir(parents=True, exist_ok=True)
temporary = output.with_name(output.name + '.partial')
if temporary.exists():
raise ValueError('Partial output already exists; inspect it before retrying')
with original.open('rb') as source, temporary.open('xb') as target:
target.write(struct.pack('<Q', len(target_header_bytes)))
target.write(target_header_bytes)
source.seek(8 + original_length)
shutil.copyfileobj(source, target, length=8 * 1024 * 1024)
changed = 0
with np.load(patch_path, allow_pickle=False) as arrays:
for entry in manifest['tensors']:
name = entry['name']
if name not in {f'model.language_model.layers.{layer}.mlp.down_proj.weight' for layer in (15, 19)}:
raise ValueError('Unexpected release tensor')
info = target_header[name]
if info['dtype'] != 'BF16' or info['shape'] != entry['shape']:
raise ValueError('Tensor shape/dtype differs')
indices, bits = arrays[entry['indices_key']], arrays[entry['bits_key']]
size = int(np.prod(info['shape']))
if indices.ndim != 1 or indices.dtype != np.dtype('uint64') or bits.dtype != np.dtype('uint16'):
raise ValueError('Invalid sparse array format')
if bits.shape != indices.shape or len(indices) != entry['changed_bitpatterns']:
raise ValueError('Sparse array lengths differ')
if len(indices) and (indices[-1] >= size or np.any(indices[1:] <= indices[:-1])):
raise ValueError('Sparse indices must be sorted, unique, and in range')
values = np.memmap(temporary, mode='r+', dtype='<u2',
offset=8 + len(target_header_bytes) + info['data_offsets'][0], shape=(size,))
values[indices] = bits
values.flush()
del values
changed += len(indices)
if changed != manifest['changed_bitpatterns'] or file_hash(temporary) != manifest['target_sha256']:
raise ValueError('Reconstructed weight file differs from the evaluated candidate')
temporary.rename(output)
return {'passed': True, 'changed_bitpatterns': changed, 'target_sha256': manifest['target_sha256'],
'byte_identical_to_evaluated_weights': True, 'model_forward_executed': False}
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--original', required=True)
parser.add_argument('--manifest', required=True)
parser.add_argument('--patch', required=True)
parser.add_argument('--output', required=True)
args = parser.parse_args()
print(json.dumps(apply_patch(args.original, args.manifest, args.patch, args.output)))
if __name__ == '__main__':
main()
|