def evaluate(self, eval_dataset, output_dir, verbose=True, silent=False, **kwargs):
    '\n        Evaluates the model on eval_dataset.\n\n        Utility function to be used by the eval_model() method. Not intended to be used directly.\n        '
    model = self.model
    args = self.args
    eval_output_dir = output_dir
    results = {}
    eval_sampler = SequentialSampler(eval_dataset)
    eval_dataloader = DataLoader(eval_dataset, sampler=eval_sampler, batch_size=args.eval_batch_size)
    if (args.n_gpu > 1):
        model = torch.nn.DataParallel(model)
    eval_loss = 0.0
    nb_eval_steps = 0
    model.eval()
    for batch in tqdm(eval_dataloader, disable=(args.silent or silent), desc='Running Evaluation'):
        inputs = self._get_inputs_dict(batch)
        with torch.no_grad():
            outputs = model(**inputs)
            loss = outputs[0]
            eval_loss += loss.mean().item()
        nb_eval_steps += 1
    eval_loss = (eval_loss / nb_eval_steps)
    results['eval_loss'] = eval_loss
    output_eval_file = os.path.join(eval_output_dir, 'eval_results.txt')
    with open(output_eval_file, 'w') as writer:
        for key in sorted(results.keys()):
            writer.write('{} = {}\n'.format(key, str(results[key])))
    return results
Evaluates the model on eval_dataset.

Utility function to be used by the eval_model() method. Not intended to be used directly.
def evaluate(self, eval_dataset, output_dir, verbose=True, silent=False, **kwargs):
    '\n        Evaluates the model on eval_dataset.\n\n        Utility function to be used by the eval_model() method. Not intended to be used directly.\n        '
    model = self.model
    args = self.args
    eval_output_dir = output_dir
    results = {}
    eval_sampler = SequentialSampler(eval_dataset)
    eval_dataloader = DataLoader(eval_dataset, sampler=eval_sampler, batch_size=args.eval_batch_size)
    if (args.n_gpu > 1):
        model = torch.nn.DataParallel(model)
    eval_loss = 0.0
    nb_eval_steps = 0
    model.eval()
    for batch in tqdm(eval_dataloader, disable=(args.silent or silent), desc='Running Evaluation'):
        inputs = self._get_inputs_dict(batch)
        with torch.no_grad():
            outputs = model(**inputs)
            loss = outputs[0]
            eval_loss += loss.mean().item()
        nb_eval_steps += 1
    eval_loss = (eval_loss / nb_eval_steps)
    results['eval_loss'] = eval_loss
    output_eval_file = os.path.join(eval_output_dir, 'eval_results.txt')
    with open(output_eval_file, 'w') as writer:
        for key in sorted(results.keys()):
            writer.write('{} = {}\n'.format(key, str(results[key])))
    return results