Downloads · 30 days
8
16% of all-time downloads
Slim205/Lean-conjecturer
Lean-conjecturer is a machine learning model from Slim205. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
This model generates Lean 4 conjectures from given theorem statements. For more details, please see https://github.com/Slim205/RL-Lean
Downloads · 30 days
8
16% of all-time downloads
All-time downloads
49
Public
Parameters
6.9B
27.6 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors27.6 GB · 100%
From the Hugging Face model README
This model generates Lean 4 conjectures from given theorem statements.
For more details, please see https://github.com/Slim205/RL-Lean
import re
from transformers import AutoTokenizer
from vllm import LLM, SamplingParams
model_name = "Slim205/Lean-conjecturer"
tokenizer = AutoTokenizer.from_pretrained(model_name)
LEAN4_DEFAULT_HEADER = "import Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n"
START_THM, END_THM = "<theorem>", "</theorem>"
START_CONJ, END_CONJ = "<conjecture>", "</conjecture>"
def get_prompt(theorem, context=''):
return f'Complete the following Lean 4 code:\n\n```lean4\n{context.strip()}\n' \
f'{START_THM}\n{theorem.strip()}\n{END_THM}\n{START_CONJ}\n theorem'
text = "theorem mathd_numbertheory_3 : (∑ x in Finset.range 10, (x + 1) ^ 2) % 10 = 5 := by"
model_inputs = [get_prompt(text)]
print(model_inputs[0])
Example output:
<theorem>
theorem mathd_numbertheory_3 : (∑ x in Finset.range 10, (x + 1) ^ 2) % 10 = 5 := by
</theorem>
<conjecture>
theorem mathd_numbertheory_24 : ∑ k in Finset.range 11, k ^ 2 = 385 := by
</conjecture>
model = LLM(model=model_name, seed=1, trust_remote_code=True, swap_space=8, tensor_parallel_size=1, max_model_len=4096)
sampling_params = SamplingParams(
temperature=1,
max_tokens=2048,
top_p=0.95,
n=1,
)
model_outputs = model.generate(model_inputs, sampling_params, use_tqdm=True)
print(model_outputs[0].outputs[0].text)