File size: 959 Bytes
fe56a4f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from Coach import Coach
from quoridor.QuoridorGame import QuoridorGame as Game
from quoridor.pytorch.NNet import NNetWrapper as nn
from utils import *

args = dotdict({
    'numIters': 500, #1000
    'numEps': 50, #100
    'tempThreshold': 0.3,
    'updateThreshold': 0.55,
    'maxlenOfQueue': 200000,
    'numMCTSSims': 300,
    'arenaCompare': 20,
    'cpuct': 2.4,

    'checkpoint': './temp/',
    'load_model': False,
    'load_folder_file': ('./temp','best.pth.tar'),
    'load_folder_examples_file': ('./temp','checkpoint_34.pth.tar'),
    'load_examples': False,
    'numItersForTrainExamplesHistory': 100,
})

if __name__=="__main__":
    g = Game(5)
    print(g.getBoardSize())
    nnet = nn(g)

    if args.load_model:
        nnet.load_checkpoint(args.load_folder_file[0], args.load_folder_file[1])

    c = Coach(g, nnet, args)
    if args.load_examples:
        print("Load trainExamples from file")
        c.loadTrainExamples()
    c.learn()