forked from lean-dojo/LeanCopilot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TacticSuggestion.lean
84 lines (53 loc) · 1.62 KB
/
TacticSuggestion.lean
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import LeanCopilot
/-
## Basic Usage
-/
example (a b c : Nat) : a + b + c = a + c + b := by
suggest_tactics
-- You may provide a prefix to constrain the generated tactics.
example (a b c : Nat) : a + b + c = a + c + b := by
suggest_tactics "rw"
/-
## Advanced Usage
-/
open Lean Meta LeanCopilot
set_option LeanCopilot.verbose true in
example (a b c : Nat) : a + b + c = a + c + b := by
suggest_tactics
set_option LeanCopilot.suggest_tactics.check false in
example (a b c : Nat) : a + b + c = a + c + b := by
suggest_tactics
sorry
/-
### Configure Generation Parameters
-/
def params := {Builtin.generator.params with
numReturnSequences := 4
minLength := 100
lengthPenalty := 1.0
temperature := 0.5
}
def updatedModel := {Builtin.generator with params := params}
#eval getModelRegistry
#eval registerGenerator "updatedModel" (.native updatedModel)
#eval getModelRegistry
set_option LeanCopilot.suggest_tactics.model "updatedModel" in
example (a b c : Nat) : a + b + c = a + c + b := by
suggest_tactics
/-
### Bring Your Own Model
1. Make sure the model is up and running, e.g., by going to ./python and running `uvicorn server:app --port 23337`.
2. Uncomment the code below.
-/
/-
def myModel : ExternalGenerator := {
name := "wellecks/llmstep-mathlib4-pythia2.8b"
host := "localhost"
port := 23337
}
#eval registerGenerator "wellecks/llmstep-mathlib4-pythia2.8b" (.external myModel)
set_option LeanCopilot.suggest_tactics.check false in
set_option LeanCopilot.suggest_tactics.model "wellecks/llmstep-mathlib4-pythia2.8b" in
example (a b c : Nat) : a + b + c = a + c + b := by
suggest_tactics
-/