liuzh91 opened a new issue #16942: Validation model can be different from fit 
model in estimator class
URL: https://github.com/apache/incubator-mxnet/issues/16942
 
 
   ## Description
   In current estimator class implementation, validation model is the same 
network as the training model `self.net`. Code of `evaluate_batch()` is shown 
below:
   
   ```
           data, label = self._get_data_and_label(val_batch, self.context, 
batch_axis)
           pred = [self.net(x) for x in data]
           loss = [self.evaluation_loss(y_hat, y) for y_hat, y in zip(pred, 
label)]
   ```
   
   This assumption does not hold true in the general case. It is common to have 
a different validation model than the training model on many tasks, e.g., the 
language model.
   
   ```
      model_eval = nlp.model.AWDRNN(args.model, len(vocab), args.emsize, 
args.nhid, args.nlayers,
                                     args.tied, args.dropout, 
args.weight_dropout,
                                     args.dropout_h, args.dropout_i, 
args.dropout_e)
      model = nlp.model.train.AWDRNN(args.model, len(vocab), args.emsize, 
args.nhid, args.nlayers,
                                      args.tied, args.dropout, 
args.weight_dropout,
                                      args.dropout_h, args.dropout_i, 
args.dropout_e)
   ```
   Please refer to 
(https://github.com/dmlc/gluon-nlp/blob/master/scripts/language_model/word_language_model.py#L154)
 for a detailed reference.
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to