Skip to content

Commit

Permalink
fix misc
Browse files Browse the repository at this point in the history
  • Loading branch information
GreenWizard2015 committed Jan 2, 2021
1 parent e9550bd commit 6f3979c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
2 changes: 0 additions & 2 deletions fit_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
import numpy as np

def train(model, memory, params):
if len(memory) < params['batchSize']: return np.Inf

modelClone = tf.keras.models.clone_model(model)
modelClone.set_weights(model.get_weights()) # use clone model for stability

Expand Down
23 changes: 12 additions & 11 deletions learn_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,18 @@ def testModel(EXPLORE_RATE):
)
print('Avg. train loss: %.4f' % trainLoss)

trainLoss = fit_stage.train(
model, doomMemory,
{
'gamma': GAMMA,
'batchSize': BATCH_SIZE,
'steps': BOOTSTRAPPED_STEPS,
'episodes': params['train doom episodes'](epoch),
'alpha': params.get('doom alpha', lambda _: alpha)(epoch)
}
)
print('Avg. train doom loss: %.4f' % trainLoss)
if params['batchSize'] < len(doomMemory):
trainLoss = fit_stage.train(
model, doomMemory,
{
'gamma': GAMMA,
'batchSize': BATCH_SIZE,
'steps': BOOTSTRAPPED_STEPS,
'episodes': params['train doom episodes'](epoch),
'alpha': params.get('doom alpha', lambda _: alpha)(epoch)
}
)
print('Avg. train doom loss: %.4f' % trainLoss)
##################
# test
print('Testing...')
Expand Down

0 comments on commit 6f3979c

Please sign in to comment.