linkedin / detext

DeText: A Deep Neural Text Understanding Framework for Ranking and Classification Tasks
BSD 2-Clause "Simplified" License
1.26k stars 133 forks source link

Update logging logic #12

Closed xwli-chelsea closed 4 years ago

xwli-chelsea commented 4 years ago

Description

Currently DeText logger logs both network structure and evaluation metrics in the following manner:

This PR consolidates the logging method and better arranges the logging output:

Fixes # (issue) AIAF-365

Type of change

Please delete options that are not relevant.

List all changes

Please list all changes in the commit. Removed unnecessary prints Use network_structure.txt file for logging variable related outputs Removed logging.txt as the useful logging is moved to network_structure.txt Tidied eval logging in best_checkpoint_copier.py

Testing

Tested the training flow with run_detext.sh. Logging files listed below:

$ ls *.txt
eval_log.txt        network_structure.txt
$ cat eval_log.txt 
***** Evaluation on dev set during training *****
## Step 2
loss : 1.2556911706924438
Checking checkpoint model.ckpt-2
keeping checkpoint model.ckpt-2 with metric/ndcg@10 = 0.7103099226951599

## Step 10
loss : 0.9746564030647278
Checking checkpoint model.ckpt-10
keeping checkpoint model.ckpt-10 with metric/ndcg@10 = 1.0
removing old checkpoint model.ckpt-2 with metric/ndcg@10 = 0.7103099226951599

***** Training finished. *****

***** Evaluation on test set with best exported model: *****
global_step = 10
loss = 0.9746564
metric/ndcg@10 = 1.0
$ cat network_structure.txt 
# Trainable variables
  w_pretrained_embedding:0, (14, 32), /device:CPU:0
  cnn/query_cnn_3/kernel:0, (3, 32, 1, 50), /device:CPU:0
  cnn/query_cnn_3/bias:0, (50,), /device:CPU:0
  cnn/doc_cnn_0_3/kernel:0, (3, 32, 1, 50), /device:CPU:0
  cnn/doc_cnn_0_3/bias:0, (50,), /device:CPU:0
  wide_ftr_norm_w:0, (10,), /device:CPU:0
  wide_ftr_norm_b:0, (10,), /device:CPU:0
  hidden_projection_0/kernel:0, (11, 100), /device:CPU:0
  hidden_projection_0/bias:0, (100,), /device:CPU:0
  scoring/kernel:0, (100, 1), /device:CPU:0
  scoring/bias:0, (1,), /device:CPU:0
total cnn parameters: 9700

Test Configuration:

Checklist