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/apply_patch.py from end000/Qwen3.5-0.8B-WSPForge-Math-v1: direct link, hf CLI and curl.
- Browser
- Download file 4.14 kB
-
https://huggingface.co/end000/Qwen3.5-0.8B-WSPForge-Math-v1/resolve/main/wspforge/apply_patch.py
- Command line
-
hf download hf://end000/Qwen3.5-0.8B-WSPForge-Math-v1/wspforge/apply_patch.py
-
curl -L -o apply_patch.py https://huggingface.co/end000/Qwen3.5-0.8B-WSPForge-Math-v1/resolve/main/wspforge/apply_patch.py
4.14 kB
| 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() | |