Commit 867f98c
authored
Hook for reporting and recording variables
* Add a --num_report_steps option to specify reporting frequency.
Currently the information for the following
* `global_step/sec` and
* `examples/sec`
gets displayed (and recorded via the summary writer) after every step.
This `--num_report_steps=N` option allows the user to specify the frequency (i.e. every N steps) with which such information should be displayed and recorded
* Enable printing and recording of throughput + loss on a periodic basis
This commit adds the ability to report (i.e. display to stdout) the following information on a periodic basis
* step number
* throughput
* total_loss
* mlm_loss
* nsp_loss
* learning_rate
The frequency of the reporting is specified via the `--num_report_steps` option.
Currently only the `throughput` and `total_loss` values get recorded (to the trace events file meant for tensorboard consumption).
Note that `throughput` is the same as `examples.sec` and `total_loss` is the same as `loss` both of which are already reported and recorded via the `TPUEstimator` implementation.
The `LogSessionRunHook` class is based on a similar class in the NVBERT implementation. It can be easily enhanced to report and record other/more variables.
* Disable the log messages from being printed twice.
Currently all the messages output via `tf.compat.v1.logging.info` get printed twice. For example
```
INFO:tensorflow:**** Trainable Variables ****
I0610 12:40:23.553335 139787876316928 run_pretraining.py:256] **** Trainable Variables ****
```
Setting the `propgate` flag in the loggger to `False` will prevent this. For the above example, only one line will be printed
```
INFO:tensorflow:**** Trainable Variables ****
```
This makes the output log file more readable.1 parent bc6324f commit 867f98c
2 files changed
+79
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
| 156 | + | |
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
256 | | - | |
| 256 | + | |
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
| |||
369 | 369 | | |
370 | 370 | | |
371 | 371 | | |
372 | | - | |
| 372 | + | |
373 | 373 | | |
374 | 374 | | |
375 | 375 | | |
| |||
481 | 481 | | |
482 | 482 | | |
483 | 483 | | |
484 | | - | |
| 484 | + | |
485 | 485 | | |
486 | 486 | | |
487 | 487 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
| |||
116 | 120 | | |
117 | 121 | | |
118 | 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 | + | |
119 | 180 | | |
120 | 181 | | |
121 | 182 | | |
| |||
158 | 219 | | |
159 | 220 | | |
160 | 221 | | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
161 | 226 | | |
162 | 227 | | |
163 | 228 | | |
| |||
416 | 481 | | |
417 | 482 | | |
418 | 483 | | |
419 | | - | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
420 | 488 | | |
421 | 489 | | |
422 | 490 | | |
| |||
468 | 536 | | |
469 | 537 | | |
470 | 538 | | |
471 | | - | |
| 539 | + | |
472 | 540 | | |
473 | 541 | | |
474 | 542 | | |
| |||
499 | 567 | | |
500 | 568 | | |
501 | 569 | | |
502 | | - | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
503 | 574 | | |
504 | 575 | | |
505 | | - | |
| 576 | + | |
506 | 577 | | |
507 | 578 | | |
508 | 579 | | |
| |||
0 commit comments