-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtune.py
More file actions
94 lines (63 loc) · 1.38 KB
/
Copy pathtune.py
File metadata and controls
94 lines (63 loc) · 1.38 KB
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
85
86
87
88
89
90
91
92
93
94
from datetime import datetime
from configs.config import (
create_directories
)
from src.data.tokenizer import (
CharacterTokenizer
)
from src.tuning.tuner import (
BardFormerTuner
)
def verify_tokenizer():
tokenizer=CharacterTokenizer()
try:
tokenizer.load()
print(
f"Vocabulary Size: {tokenizer.vocab_size}"
)
except FileNotFoundError:
print(
"Tokenizer artifacts not found."
)
print(
"Building tokenizer..."
)
tokenizer.fit()
print(
f"Vocabulary Size: {tokenizer.vocab_size}"
)
return tokenizer
def print_header():
print("\n"+"="*80)
print("BardFormer Hyperparameter Search")
print("="*80)
def main():
start_time=datetime.now()
print_header()
create_directories()
verify_tokenizer()
tuner=BardFormerTuner()
print("\nStarting Hyperparameter Search")
print("-"*80)
search=tuner.search(
epochs=3
)
print("\nSearch Complete")
print("-"*80)
tuner.print_best_results(
search
)
end_time=datetime.now()
print("\nFinished")
print("-"*80)
print(
f"Started : {start_time}"
)
print(
f"Finished : {end_time}"
)
print(
f"Duration : {end_time-start_time}"
)
if __name__=="__main__":
main()