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,403 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 | # ThinkingCap pipeline
Goal: same accuracy, fewer generated tokens (thinking included) for Qwen3-0.6B, scored by
[ThinkingCap-Test](https://github.com/BottleCapAI/ThinkingCap-Test) @ `bd52d8d`, run unmodified.
**All results are in the [root README](../README.md).** This file covers how to run things.
## Method
1. **setup**: their `prepare_data.py` (full train set: gsm8k, skywork, commonsense_qa, arc_easy).
Drop questions sharing a 13-word sequence with any benchmark prompt, and prompts over 4096 tokens.
2. **baseline**: 4 uncoached student samples per problem (eval sampling, 4096 cap).
A problem is eligible only if ≥2/4 are correct; `ref_len` = median length of the correct ones.
3. **coach**: Qwen3-8B sees the problem plus the median-length *correct* trace, never the gold answer, and
gives three brevity-only bullets. Coaching that names the gold number (math) or any option
(label or text) is rejected and retried up to 3 times.
4. **candidates**: 4 samples per arm. *control* = plain prompt; *coached* = prompt + bullets.
Target = shortest correct finished sample, kept only if strictly shorter than `ref_len`.
5. **train**: LoRA r=8 on q/v, trained on the **original prompt** (no coaching) → target. 2 epochs,
checkpoint every half epoch. Each arm uses its own accepted set.
6. **eval / compare**: their `evaluate.py` (8 samples) on the base model and every checkpoint, then `compare.py`.
The non-LoRA arms (`arms.json`, `arms.py`) reuse step 5's coached targets and the same training loop.
## Running (from the repo root)
```
# LoRA run
.modal-venv/bin/modal run --detach thinkingcap/modal_app.py --stage smoke
.modal-venv/bin/modal run --detach thinkingcap/modal_app.py --stage setup # then eval-base, baseline,
# coach, candidates, train,
# eval-ckpts, compare
# non-LoRA arms
.modal-venv/bin/modal run --detach thinkingcap/modal_app.py --stage arms-smoke # verify + short train + smoke eval
.modal-venv/bin/modal run --detach thinkingcap/modal_app.py --stage arms-full # train, eval, compare every arm
.modal-venv/bin/modal run --detach thinkingcap/modal_app.py --stage arms-extend --arm extra-mlp-64-l17,extra-mlp-64-l20
# side experiments
.modal-venv/bin/modal run --detach thinkingcap/first_token_app.py --words First,To
.modal-venv/bin/modal run --detach thinkingcap/first_token_app.py --words First --arms extra-mlp-64/step-00170
.modal-venv/bin/modal run thinkingcap/layer_probe_app.py --arms extra-mlp-64/step-00170
.modal-venv/bin/modal volume get thinkingcap evals/summary_arms.json .
python -m unittest thinkingcap/test_pipeline.py # local, no GPU
```
For long runs, `modal deploy thinkingcap/modal_app.py` first, then pass `--deployed` to `modal run` (without `--detach`).
That way nothing depends on the laptop staying up. Every stage resumes where it stopped.
Settings live in `config.json`. A run refuses to continue if the config changed, so start a new `--run` name instead.
`test_arms.py` needs `torch` and `transformers`.
The MLP arms export with `architectures=["Qwen3ReasoningMLPForCausalLM"]` and need `vllm_plugin/` installed
in the eval image, which `modal_app.py` does. The block arms export as plain 29-layer Qwen3 checkpoints.
## Results files (`results/`)
- `summary.json` (LoRA), `summary_arms.json` (arms), `summary_first_token.json`: `compare.py` output for every run.
- `evals/NAME/`: `results.json` from `evaluate.py`, plus `compare.txt` / `compare.json` vs `base`
(`forced.json` for forced-first-token runs).
- `adapters/{coached,control}/step-N/`: PEFT LoRA adapters (`adapter_model.safetensors`) for `Qwen/Qwen3-0.6B`.
- `arms_verify/`: identity / roundtrip / vLLM checks for each arm.
- `probes/{base,extra-mlp-64-step-00170}/probe.json`: per-layer logit-lens and plan-probe table.
- `run/`: config, setup, baseline / coaching / selection summaries, stage timings.
Not committed because they are too large. They are still on the `thinkingcap` Modal volume:
- Arm weights: `runs/full/arms/NAME/step-N/`, about 50 MB each.
- Per-sample `records.jsonl` for each eval: about 65 MB each, under `evals/`.
- Probe `directions.pt`.
- Training and candidate jsonl files, and optimizer state, under `runs/full/`.
|