Example #1
0
      len(dev), '\n test:', len(test))

cache = phyre.get_default_100k_cache(tier)
print('cache.action_array shape:', cache.action_array.shape)

from dqn import DQNAgent

agent = DQNAgent()

#model = agent.build_model()
#new_model = TestModel()
#model.load_state_dict(torch.load("./model/test_model.pth"))
#state = dict(model =model, cache = cache)

state, statistic = agent.train(cache, train, tier, test)

loss = agent.get_test_loss(state, test, tier)
print('test_loss')
print(loss)

model = state['model']

#save
savePath = "./model/32_black_within.pth"
torch.save(model.state_dict(), savePath)

file=open("./model/32_black_statistic","wb") 
pickle.dump(statistic,file) 
file.close()