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: 2,258 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 | """layer_probe.py on Modal: one H100 per model, base traces replayed through each.
.modal-venv/bin/modal run thinkingcap/layer_probe_app.py --per-dataset 8 # quick check
.modal-venv/bin/modal run thinkingcap/layer_probe_app.py
.modal-venv/bin/modal run thinkingcap/layer_probe_app.py --arms extra-mlp-64/step-00170
Every model replays the same base-model traces (evals/base/records.jsonl), so an arm's table reads as
"what this arm does to the base model's thinking", layer by layer. Results: probes/NAME/probe.json.
"""
import json
import subprocess
import sys
from pathlib import Path
import modal
from modal_app import STATE, image, volume
image = image.add_local_python_source('modal_app')
app = modal.App('thinkingcap-layer-probe')
SCRIPT = '/opt/thinkingcap/layer_probe.py'
def probe_name(arm, per_dataset):
return (arm.replace('/', '-') if arm else 'base') + ('' if per_dataset == 100 else f'-n{per_dataset}')
@app.function(image=image, gpu='H100', cpu=4, memory=32768, volumes={STATE: volume}, timeout=2 * 60 * 60)
def probe(arm: str, per_dataset: int) -> str:
volume.reload()
out = Path(STATE) / 'probes' / probe_name(arm, per_dataset)
command = [sys.executable, SCRIPT, '--questions', f'{STATE}/questions',
'--records', f'{STATE}/evals/base/records.jsonl', '--out', str(out),
'--per-dataset', str(per_dataset)]
if arm:
command += ['--model', f'{STATE}/runs/full/arms/{arm}/model']
try:
subprocess.run(command, cwd='/opt/tc', check=True)
finally:
volume.commit()
return json.dumps(json.loads((out / 'probe.json').read_text()))
@app.local_entrypoint()
def main(arms: str = '', base: bool = True, per_dataset: int = 100):
targets = ([''] if base else []) + [a.strip() for a in arms.split(',') if a.strip()]
local = Path(__file__).resolve().parent / 'results' / 'probes'
for arm, report in zip(targets, probe.map(targets, kwargs={'per_dataset': per_dataset})):
name = probe_name(arm, per_dataset)
(local / name).mkdir(parents=True, exist_ok=True)
(local / name / 'probe.json').write_text(json.dumps(json.loads(report), indent=2) + '\n')
print(f'== {name}: {local / name / "probe.json"}')
|