code: def get_metrics(data_dir, model):
      trainer = pl.Trainer(devices=[0], accelerator="gpu")
  
      model.set_trainer(trainer)
      model.update_data_dir(data_dir)
  
      test_ds = OmegaConf.create(
          {
              "text_file": "text_dev.txt",
              "labels_file": "labels_dev.txt",
              "shuffle": False,
              "num_samples": -1,
              "batch_size": 8,
          }
      )
  
      model._cfg.dataset.use_cache = False
      model.setup_test_data(test_data_config=test_ds)
      metrics = trainer.test(model)[0]
  
      return metrics
  
file_path: NeMo/tests/collections/nlp/test_pretrained_models_performance.py
imports: import os
  from pathlib import Path
  from shutil import rmtree
  from unittest import TestCase
  import pytest
  import pytorch_lightning
  from omegaconf import OmegaConf
  import nemo.collections.nlp.models
label_desc: Use image node_id 1 for calling a global function with example usage: get_metrics(data_dir, model) and returns: metrics