/
config.py
230 lines (203 loc) · 6.8 KB
/
config.py
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
import sys
import games.warPoker
import games.pokemon
#This is the file for configuring everything
#there may be some bugs if the size of things in models aren't powers of 2 (or at least even) #you have been warned
#game-specific configuration
class Pokemon:
#format = '1v1'
format = 'challengecup1v1'
history = [[],[]]
class WarPoker:
history = [[],[]]
#general settings
#search
#whether to print out each line in our training games (for debugging)
verboseTraining = False
#whether to print details for each validation pass
verboseValidation = True
#show the gradient plot every so many epochs (None to disable)
gradPlotStride = 200
#data storage
dataDir = '/home/sam/data-ssd/'
#whether to store all samples in RAM rather than on disk
inMemory = False
#whether to explicitly cache samples from disk in RAM
bigCache = False
#playing actual non-training games
#ignore moves with probabilities below this (likely just noise)
probCutoff = 0.03
#how many games to play after training
numTestGames = 10
#general game config
#gameName = 'warPoker'
gameName = 'pokemon'
if gameName == 'warPoker':
game = games.warPoker
GameConfig = WarPoker
#search
#number of search processes (limited by cpu utilization and gpu memory)
#set to 0 to run search in main thread (mainly for debugging)
#not sure this is being used anymore
numProcesses = 10
#number of search iterations
limit = 100
#seed for all search games, None for default
seed = None
#which search iteration to start from, None for fresh start (delete data)
resumeIter = None
#number of game tree traversals per search iteration
innerLoops = 1000
#limit on number of branches to take per action in a traversal
#(branches not taken are still possibly probed via rollout)
branchingLimit = 1
#whether to probe branches not taken
enableProbingRollout=True
#maximum depth in a traversal before rollout
depthLimit = None
#odds of the off player making a random move
offExploreRate = 0
#odds of the on player making a random move
#only used if branchingLimit is not none
onExploreRate = 0.2
#how many games to record per training iteration
progressGamesToRecord = 10
progressGamePath = 'progress/'
#training
#number of epochs for training the advantage network
advEpochs = 500
#number of epochs for training the strategy network
stratEpochs = 5
#maximum number of samples in an epoch
epochMaxNumSamples = 50000
#number of samples in a batch
miniBatchSize = 4096
#number of workers for the data loader
numWorkers = 1
#whether to create a fresh advantage network for each iteration
newIterNets = True
singleDeep = True
#model
#number of bits for numbers in infosets
numTokenBits = 0
#maximum size for infoset vocabulary
vocabSize = 256
#size of embedding vector
embedSize = 16
#dropout rate after embedding during training
embedDropoutPercent = 0.5
#cnn stuff
enableCnn = False
#size of hidden state of the lstm (split in half if we're using a bidirection lstm)
lstmSize = 16
#number of lstm layers
numLstmLayers = 1
#dropout percentage for the lstm
lstmDropoutPercent = 0
#size of each fully connected layer
width = 16
#enable an attention layer after the lstm
enableAttention = False
#learn rate for training
learnRate = 0.001
#which optimizer to use (adam or sgd)
optimizer = 'adam'
#whether to use a scheduler for the learning rate
useScheduler = False
#the patience of the schedule (# of epochs before reducing learn rate)
schedulerPatience = 20
#what factor to use to reduce the learn rate
schedulerFactor = 0.5
#what fraction of samples to use for validation
valSplit = 0.3
#how many samples to cache before writing to disk (give or take)
sampleCacheSize = 1000
#max size on number of samples (only supported for on-disk sample storage)
#not sure that this is being used anymore
maxNumSamples = {
'adv0': None,
'adv1': None,
'strat0': 50000,
'strat1': 50000,
}
elif gameName == 'pokemon':
game = games.pokemon
GameConfig = Pokemon
#search
#number of search iterations
limit = 300
#seed for all search games, None for default
seed = None
#which search iteration to start from, None for fresh start (delete data)
resumeIter = None
#number of game tree traversals per search iteration
innerLoops = 50
#limit on number of branches to take per action in a traversal
#(branches not taken are still possibly probed via rollout)
branchingLimit = 1
#whether to probe branches not taken
enableProbingRollout=False
#maximum depth in a traversal before rollout
depthLimit = 20
#odds of the off player making a random move
offExploreRate = 0
#odds of the on player making a random move
#only used if branchingLimit is not none
onExploreRate = 0.2
#how many games to record per training iteration
progressGamesToRecord = 6
progressGamePath = 'progress/'
#training
#number of epochs for training the advantage network
advEpochs = 200
#number of epochs for training the strategy network
stratEpochs = 5
#maximum number of samples in an epoch
epochMaxNumSamples = 1000000
#number of samples in a batch
miniBatchSize = 512
#number of workers for the data loader
numWorkers = 8
#whether to create a fresh advantage network for each iteration
newIterNets = True
singleDeep = True
#model
#number of bits for numbers in infosets
numTokenBits = 3
#maximum size for infoset vocabulary
vocabSize = 4096
#size of embedding vector
embedSize = 128
#dropout rate after embedding during training
embedDropoutPercent = 0.5
#cnn stuff
enableCnn = False
#size of hidden state of the lstm
lstmSize = 128
#number of lstm layers
numLstmLayers = 1
#dropout percentage for the lstm
lstmDropoutPercent = 0
#size of each fully connected layer
width = 32
#enable an attention later after the lstm
enableAttention = False
#learn rate for training
learnRate = 0.001
#which optimizer to use (adam or sgd)
optimizer = 'adam'
#whether to use a scheduler for the learning rate
useScheduler = False
#the patience of the schedule (# of epochs before reducing learn rate)
schedulerPatience = 10
#what factor to use to reduce the learn rate
schedulerFactor = 0.5
#what fraction of samples to use for validation
valSplit = 0.3
#how many samples to cache before writing to disk (give or take)
sampleCacheSize = 1000
#max size on number of samples (only supported for on-disk sample storage)
maxNumSamples = {
'adv0': None,
'adv1': None,
}