-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
42 lines (35 loc) · 1.26 KB
/
main.py
File metadata and controls
42 lines (35 loc) · 1.26 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
import sys
import argparse
def main():
parser = argparse.ArgumentParser(description='GRU BasicTester')
parser.add_argument('--test', choices=['PTB', 'MNIST'], help='选择要运行的测试类型')
parser.add_argument('--draw-only', action='store_true', help='仅绘制图表,不运行测试')
parser.add_argument('--find', action='store_true', help='是否进行参数搜索')
parser.add_argument('--group', type=int, default=0, help='选择要训练的模型组 (默认: 0)')
args = parser.parse_args()
if args.draw_only:
from PyQt5.QtWidgets import QApplication
from utils.Draw import MainWindow
app = QApplication(sys.argv)
window = MainWindow()
window.show()
sys.exit(app.exec_())
elif args.find:
from utils.Finder import MNISTFinder
finder_map = {
'MNIST': MNISTFinder,
}
f = finder_map[args.test]()
f.run()
else:
from utils.Comparator import MNISTComparer
from utils.Comparator import PTBComparer
comparator_map = {
'PTB': PTBComparer,
'MNIST': MNISTComparer,
}
c = comparator_map[args.test]()
c.choice(args.group)
c.run()
if __name__ == "__main__":
main()