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/grading.py from end000/Qwen3.5-0.8B-WSPForge-Math-v1: direct link, hf CLI and curl.
- Browser
- Download file 2.56 kB
-
https://huggingface.co/end000/Qwen3.5-0.8B-WSPForge-Math-v1/resolve/main/wspforge/research_code/src/grading.py
- Command line
-
hf download hf://end000/Qwen3.5-0.8B-WSPForge-Math-v1/wspforge/research_code/src/grading.py
-
curl -L -o grading.py https://huggingface.co/end000/Qwen3.5-0.8B-WSPForge-Math-v1/resolve/main/wspforge/research_code/src/grading.py
2.56 kB
| import re | |
| from collections import Counter | |
| def extract(text): | |
| text = text.split('</think>')[-1].strip() | |
| index = text.rfind('\\boxed') | |
| if index < 0: | |
| index = text.rfind('\\fbox') | |
| if index < 0: | |
| return None | |
| key = '\\boxed' if text.startswith('\\boxed', index) else '\\fbox' | |
| rest = text[index + len(key):] | |
| stripped = rest.lstrip() | |
| if stripped.startswith('{'): | |
| depth = 0 | |
| for i, char in enumerate(stripped): | |
| depth += (char == '{') - (char == '}') | |
| if depth == 0: | |
| return stripped[1:i].strip() or None | |
| elif key == '\\boxed' and rest.startswith(' '): | |
| return rest.strip().split('$')[0].split('\n')[0].strip() or None | |
| return None | |
| def correct(prediction, gold): | |
| if prediction is None: | |
| return False | |
| from math_verify import parse, verify | |
| reference = parse('\\boxed{' + gold + '}', parsing_timeout=5) | |
| candidate = parse('\\boxed{' + prediction + '}', parsing_timeout=5) | |
| return bool(reference and candidate and verify(reference, candidate, timeout_seconds=5)) | |
| def repetition(text): | |
| words = text.split()[-1000:] | |
| grams = [tuple(words[i:i + 8]) for i in range(max(0, len(words) - 7))] | |
| duplicate = 1 - len(set(grams)) / max(1, len(grams)) | |
| tail = words[-200:] | |
| four = [tuple(tail[i:i + 4]) for i in range(max(0, len(tail) - 3))] | |
| counts = Counter(four) | |
| repetitive = bool(four) and sum(counts[g] >= 3 for g in four) / len(four) >= .5 | |
| return {'duplicate_8gram_tail': duplicate, 'repetitive_end': repetitive, | |
| 'whitespace_tail': bool(text) and not text[-1000:].strip(), | |
| 'thinking_closed': '</think>' in text} | |
| def grade_ifeval(row, text): | |
| import nltk | |
| from common import ROOT | |
| from langdetect import DetectorFactory | |
| from instruction_following_eval import instructions_registry as registry | |
| nltk.data.path[:] = [str(ROOT / 'data/nltk')] | |
| DetectorFactory.seed = 0 | |
| response = text.split('</think>')[-1].strip() if '</think>' in text else '' | |
| flags = [] | |
| for instruction_id, kwargs in zip(row['instruction_id_list'], row['kwargs']): | |
| checker = registry.INSTRUCTION_DICT[instruction_id](instruction_id) | |
| checker.build_description(**{k: v for k, v in (kwargs or {}).items() if v is not None}) | |
| args = checker.get_instruction_args() | |
| if args and 'prompt' in args: | |
| checker.build_description(prompt=row['prompt']) | |
| flags.append(bool(response) and bool(checker.check_following(response))) | |
| return all(flags) | |