internlm/Lean-Workbook
Viewer • Updated • 25.2k • 652 • 56
How to use kfdong/STP_model_Lean with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="kfdong/STP_model_Lean")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("kfdong/STP_model_Lean")
model = AutoModelForCausalLM.from_pretrained("kfdong/STP_model_Lean")
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=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use kfdong/STP_model_Lean with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "kfdong/STP_model_Lean"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "kfdong/STP_model_Lean",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/kfdong/STP_model_Lean
How to use kfdong/STP_model_Lean with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "kfdong/STP_model_Lean" \
--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": "kfdong/STP_model_Lean",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "kfdong/STP_model_Lean" \
--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": "kfdong/STP_model_Lean",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use kfdong/STP_model_Lean with Docker Model Runner:
docker model run hf.co/kfdong/STP_model_Lean
This is the final Self-play Theorem Prover model as described in the paper https://arxiv.org/abs/2502.00212. The training and evalution code is avaliable here.
@article{dong2025beyond,
title={Beyond Limited Data: Self-play LLM Theorem Provers with Iterative Conjecturing and Proving},
author={Dong, Kefan and Ma, Tengyu},
journal={arXiv preprint arXiv:2502.00212},
year={2025}
}
The table below compares the pass@3200 performance of STP (our model) and DeepSeek-Prover-V1.5 on miniF2F-test and ProofNet-test.
| miniF2F-test | ProofNet-test | |
|---|---|---|
| DeepSeek-Prover-V1.5-SFT | 53.3% ± 0.5% | 21.0% ± 0.9% |
| DeepSeek-Prover-V1.5-RL | 54.9% ± 0.7% | 22.0% ± 0.5% |
| STP | 61.7% ± 0.6% | 23.1% ± 0.5% |
We also release the dataset here, which contains:
Our final model is finetuned from DeepSeek-Prover-V1.5-SFT with this dataset for 1 epoch.
Base model
deepseek-ai/DeepSeek-Prover-V1.5-Base