Interactive Lean-proof suggestions, theorem exploration, education.
Research on automated theorem proving.
Open-domain advice, legal/medical claims, guaranteed proof correctness.
Model may hallucinate or output invalid Lean code; inherits errors in the STP dataset.
1from transformers import AutoTokenizer, AutoModelForCausalLM
2
3model_id = "haielab/STP_model_Lean_0320-conjecture-base-FineTune-new-config"
4
5# 1️⃣ Tokenizer ─ leave default right padding for STP
6tok = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
7tok.pad_token = tok.eos_token # STP uses </s> as PAD
8
9# 2️⃣ Load base-plus-LoRA adapter on GPU (BF16)
10model = AutoModelForCausalLM.from_pretrained(
11 model_id,
12 torch_dtype="bfloat16",
13 device_map="auto" # auto-dispatch to available GPU(s)
14)
15
16# 3️⃣ Build a Lean-style prompt
17prompt = "<user>Theorem foo …</user><assistant>"
18
19inputs = tok(prompt, return_tensors="pt").to(model.device)
20
21# 4️⃣ Generate the next proof steps
22out = model.generate(
23 **inputs,
24 max_new_tokens=256,
25 temperature=0.7,
26 top_p=0.9,
27)
28print(tok.decode(out[0], skip_special_tokens=True))