This notebook demonstrates how to read the newer proto-based logs.


In [2]:
# Point to where you have logs stored.
logfile = '../python/listops_rlspinn_test_run.log'

In [3]:
import sys
sys.path.append('../python')

In [4]:
import spinn.util.logging_pb2 as pb
from google.protobuf import text_format

Parsing the logs is pretty simple. Just read the raw text, and use the text_format module.

To load the logs, use the Merge() function.


In [5]:
text = open(logfile, 'r').read()
len(text)


Out[5]:
119552

In [7]:
logs = pb.SpinnLog()
parsed = text_format.Merge(text, logs)

In [10]:
# When was the first run in this log executed?
# This is the output of time.time() before running the first step.
parsed.header[0].start_time


Out[10]:
1497416353L

In [12]:
print(len(parsed.entries))
parsed.entries[33]


90
Out[12]:
step: 660
class_accuracy: 0.1484375
transition_accuracy: 0.546630084515
total_cost: 2.20463657379
cross_entropy_cost: 2.19916176796
transition_cost: 0.729857027531
l2_cost: 0.0055211847648
time_per_token_seconds: 0.000479944283143
learning_rate: 0.000200209979084
invalid: 0.990625023842
policy_cost: -4.64298027509e-05
mean_adv_mean: -0.00362138007767
mean_adv_mean_magnitude: 0.0342777445912
mean_adv_var: 0.00262261158787
mean_adv_var_magnitude: 0.00144161016215
epsilon: 0.986886739731
temperature: 1.0