Noogal commited on
Commit
7b5bbcc
1 Parent(s): 082c2e0

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +41 -0
README.md ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Usage:
2
+
3
+ ```python
4
+ import torch
5
+ from transformers import AutoTokenizer, AutoModelForCausalLM
6
+
7
+ question_template = "<|im_start|>user\nMy LEAN 4 state is:\n```{state}```\nPlease write down the reasoning that leads to the possible next tactic and then predict the tactic to help me prove the theorem.<|im_end|>\n<|im_start|>assistant\n"
8
+
9
+ model_name = "ScalableMath/Lean-STaR-plus"
10
+ model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.bfloat16, device_map="auto")
11
+
12
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
13
+
14
+ state = "x : \u211d\nn : \u2115\nh\u2080 : -1 < x\nh\u2081 : 0 < n\n\u22a2 1 + \u2191n * x \u2264 (1 + x) ^ n"
15
+ question = question_template.format(state=state)
16
+
17
+ input_tensor = torch.tensor([tokenizer.encode(question)])
18
+ outputs = model.generate(input_tensor.to(model.device), max_new_tokens=500)
19
+
20
+ result = tokenizer.decode(outputs[0], skip_special_tokens=True)
21
+ print(result)
22
+ ```
23
+
24
+ Example Results:
25
+ ```
26
+ # State
27
+
28
+ x : ℝ
29
+ n : ℕ
30
+ h₀ : -1 < x
31
+ h₁ : 0 < n
32
+ ⊢ 1 + ↑n * x ≤ (1 + x) ^ n
33
+
34
+ # Reasoning
35
+
36
+ To prove the inequality involving the binomial expansion of `(1 + x)^n`, we start by considering the binomial expansion of `1 + x` raised to the power `n`. This expansion will allow us to compare the left-hand side and the right-hand side of the inequality.
37
+
38
+ # Next Tactic
39
+
40
+ have h₂ : x = -1 + (x + 1) := by simp
41
+ ```