code: def get_model_provider(eval_metric):
      """Based on evaluation metric set the parallel-output flag and
      return the model provider."""
  
      def model_provider(pre_process=True, post_process=True):
          """Build the model."""
  
          config = core_transformer_config_from_args(get_args())
  
          if eval_metric == "loss":
              parallel_output = True
          elif eval_metric == "accuracy":
              parallel_output = False
          else:
              raise NotImplementedError(
                  "output type for {} evaluation metric "
                  "is not supported.".format(eval_metric)
              )
  
          print_rank_0("building GPT model ...")
          model = GPTModel(
              config,
              num_tokentypes=0,
              parallel_output=parallel_output,
              pre_process=pre_process,
              post_process=post_process,
          )
  
          return model
  
      return model_provider
  
file_path: megatron-lm/tasks/zeroshot_gpt/evaluate.py
imports: import math
  import torch
  from megatron import get_args
  from megatron import print_rank_0, is_last_rank
  from megatron import get_tokenizer
  from megatron.core import parallel_state, tensor_parallel
  from megatron.checkpointing import load_checkpoint
  from megatron.model import GPTModel
  from megatron.training import get_model
  from megatron.utils import get_ltor_masks_and_position_ids, unwrap_model
  from megatron.core.pipeline_parallel.p2p_communication import recv_forward, send_forward
  from megatron.arguments import core_transformer_config_from_args
  from tasks.finetune_utils import build_data_loader
  from .datasets import build_dataset
label_desc: Use image node_id 1 for calling a global function with example usage: get_model_provider(eval_metric) and returns: model_provider, model