Skip to content
Snippets Groups Projects
Commit eebab89e authored by Franck Dary's avatar Franck Dary
Browse files

Improved debug readability

parent 4a7dabd5
No related branches found
No related tags found
No related merge requests found
...@@ -90,11 +90,13 @@ class Config : ...@@ -90,11 +90,13 @@ class Config :
printedCols = ["ID","FORM","UPOS","HEAD","DEPREL"] printedCols = ["ID","FORM","UPOS","HEAD","DEPREL"]
left = 5 left = 5
right = 5 right = 5
historySize = 8
historyPopSize = 6
print("state :", self.state, file=output) print("state :", self.state, file=output)
print("stack :",[self.getAsFeature(ind, "ID") for ind in self.stack], file=output) print("stack :",[int(self.getAsFeature(ind, "ID")) for ind in self.stack], file=output)
print("nbUndone :", self.nbUndone, file=output) print("nbUndone :", self.nbUndone, file=output)
print("history :",[str(trans) for trans in self.history], file=output) print("history :",[str(trans) for trans in self.history[-historySize:]], file=output)
print("historyPop :",[(str(c[0]),"dat:"+str(c[1]),"mvt:"+str(c[2]),"reward:"+str(c[3]),"state:"+str(c[4])) for c in self.historyPop], file=output) print("historyPop :",[(str(c[0]),"reward:"+str(c[3])) for c in self.historyPop[-historyPopSize:]], file=output)
toPrint = [] toPrint = []
for lineIndex in range(self.wordIndex-left, self.wordIndex+right) : for lineIndex in range(self.wordIndex-left, self.wordIndex+right) :
if lineIndex not in range(len(self.lines)) : if lineIndex not in range(len(self.lines)) :
......
...@@ -271,6 +271,7 @@ def trainModelRl(debug, networkName, modelDir, filename, nbIter, batchSize, devF ...@@ -271,6 +271,7 @@ def trainModelRl(debug, networkName, modelDir, filename, nbIter, batchSize, devF
probaOracle = list_probas[fromState][1] probaOracle = list_probas[fromState][1]
if debug : if debug :
print("-"*80, file=sys.stderr)
sentence.printForDebug(sys.stderr) sentence.printForDebug(sys.stderr)
action = selectAction(policy_net, state, transitionSet, sentence, missingLinks, probaRandom, probaOracle, fromState) action = selectAction(policy_net, state, transitionSet, sentence, missingLinks, probaRandom, probaOracle, fromState)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment