def get_model_provider(eval_metric):
    """Based on evaluation metric set the parallel-output flag and
    return the model provider."""

    def model_provider():
        """Build the model."""

        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 GPT2 model ...')
        model = GPT2Model(num_tokentypes=0, parallel_output=parallel_output)

        return model

    return model_provider
Based on evaluation metric set the parallel-output flag and
    return the model provider.
megatron_lm/tasks/zeroshot_gpt2/evaluate.py