Instructions to use mrtineu/thinkingcap-test-submission with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mrtineu/thinkingcap-test-submission with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mrtineu/thinkingcap-test-submission") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("mrtineu/thinkingcap-test-submission") model = AutoModelForCausalLM.from_pretrained("mrtineu/thinkingcap-test-submission", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.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(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use mrtineu/thinkingcap-test-submission with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mrtineu/thinkingcap-test-submission" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mrtineu/thinkingcap-test-submission", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/mrtineu/thinkingcap-test-submission
- SGLang
How to use mrtineu/thinkingcap-test-submission 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 "mrtineu/thinkingcap-test-submission" \ --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": "mrtineu/thinkingcap-test-submission", "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 "mrtineu/thinkingcap-test-submission" \ --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": "mrtineu/thinkingcap-test-submission", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use mrtineu/thinkingcap-test-submission with Docker Model Runner:
docker model run hf.co/mrtineu/thinkingcap-test-submission
File size: 4,132 Bytes
6361ca2 | 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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | """Forced first thinking token (Liu et al. 2026, arXiv:2610.34350) on the ThinkingCap benchmarks.
Runs their evaluate.py with the reply pre-filled as `<think>\\nWORD`, so the student's first
reasoning token is WORD instead of its natural choice (Qwen3-0.6B opens with "Okay" 99.9% of
the time). The forced tokens are put back at the front of every record, so reasoning-token counts
and grading see the whole reply, and each generation cap shrinks by their length so the total
stays within the recipe's budget. Run from the ThinkingCap-Test checkout:
python first_token.py eval --force To -- --questions /vol/questions --out /vol/evals/force-To
python first_token.py compare /vol/evals/base /vol/evals/force-To --out compare.json
compare is their compare.py minus the refusal to compare two runs of the same weights.
"""
import argparse
import json
import os
import sys
from pathlib import Path
from types import SimpleNamespace
sys.path.insert(0, os.getcwd())
def forced_ids(tokenizer, word):
ids = tokenizer.encode('<think>\n' + word, add_special_tokens=False)
if ids[0] != tokenizer.convert_tokens_to_ids('<think>'):
raise ValueError(f'<think> did not tokenize as one token: {ids}')
return ids
def run_eval(word, evaluate_args):
import evaluate
build_jobs, to_record, token_cap = evaluate.build_jobs, evaluate.to_record, evaluate.token_cap
forced = []
def forced_build_jobs(questions, tokenizer, arguments):
forced[:] = forced_ids(tokenizer, word)
print(f'forcing {word!r} as {forced}', flush=True)
jobs = build_jobs(questions, tokenizer, arguments)
for job in jobs:
job['ids'] = job['ids'] + forced
return jobs
def forced_to_record(job, output, lora, tokenizer, eos_ids, open_id, close_id):
result = output.outputs[0]
whole = SimpleNamespace(lora_request=output.lora_request,
outputs=[SimpleNamespace(token_ids=forced + list(result.token_ids))])
return {**to_record(job, whole, lora, tokenizer, eos_ids, open_id, close_id), 'forced': word}
evaluate.build_jobs = forced_build_jobs
evaluate.to_record = forced_to_record
# generation gets the cap minus the forced tokens; engine sizing and results.json keep the recipe's
evaluate.token_cap = lambda dataset, arguments: token_cap(dataset, arguments) - len(forced)
evaluate.caps_in_use = lambda questions, arguments: {
d: token_cap(d, arguments) for d in sorted({q['dataset'] for q in questions})}
sys.argv = ['evaluate.py', *evaluate_args]
evaluate.main()
out = Path(evaluate_args[evaluate_args.index('--out') + 1])
(out / 'forced.json').write_text(json.dumps({'word': word, 'ids': forced}) + '\n')
def run_compare(base, candidate, out):
from utils.eval import compare as tc_compare
check = tc_compare.check
def check_ignoring_weights(base_meta, candidate_meta):
return check(base_meta, {**candidate_meta, 'model': f"{candidate_meta['model']} (forced first token)"})
tc_compare.check = check_ignoring_weights
comparison = tc_compare.compare(base, candidate)
if out:
Path(out).write_text(json.dumps(comparison, indent=2) + '\n')
print(tc_compare.report(comparison))
def main():
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
sub = parser.add_subparsers(dest='command', required=True)
ev = sub.add_parser('eval')
ev.add_argument('--force', required=True, help='First reasoning word, e.g. To, First, Okay')
ev.add_argument('evaluate_args', nargs=argparse.REMAINDER, help='-- then evaluate.py arguments')
cmp = sub.add_parser('compare')
cmp.add_argument('base')
cmp.add_argument('candidate')
cmp.add_argument('--out')
arguments = parser.parse_args()
if arguments.command == 'eval':
rest = arguments.evaluate_args
run_eval(arguments.force, rest[1:] if rest[:1] == ['--'] else rest)
else:
run_compare(arguments.base, arguments.candidate, arguments.out)
if __name__ == '__main__':
main()
|