human
Complete the below
def create_evaluation_metrics(problems, model_hparams):

    ''''Creates the evaluation metrics for the model.
    Args:
    problems: List of tuples (problem name, problem instance).
    model_hparams: a set of hparams.
    Returns:
    A dictionary with keys that are strings naming the evaluation
    metrics and values that are functions taking arguments of
    (predictions, targets), returning a tuple of a tensor of the
    metric\'s value together with an op to update the metric\'s value.
    Raises:
    ValueError: if the metrics specified by a problem are not recognized (i.e.
    are not defined in the Metrics enum.'
    '''
 ... Write me a the Python program you requested?
assistant
#Here is the Python program you requested.
    def make_problem_specific_metric_fn(metric_fn, problem_idx, weights_fn):
        'Create    a    metric    fn    conditioned    on    problem_idx.'
        def problem_metric_fn(predictions, labels, weights):
            problem_choice = weights
            (scores, weights) = tf.cond(tf.equal(problem_idx, problem_choice), (lambda : metric_fn(predictions, labels, weights_fn=weights_fn)), (lambda : (tf.constant(0.0), tf.constant(0.0))))
            return tf.metrics.mean(scores, weights)
        return problem_metric_fn
    eval_metrics = dict()
    for (problem_idx, (problem_name, problem_instance)) in enumerate(problems):
        if (problem_instance is None):
            metrics = [Metrics.ACC, Metrics.ACC_TOP5, Metrics.ACC_PER_SEQ, Metrics.NEG_LOG_PERPLEXITY]
            if ('wmt' in problem_name):
                metrics.append(Metrics.APPROX_BLEU)
        else:
            metrics = problem_instance.eval_metrics()
            if (not all([(m in METRICS_FNS) for m in metrics])):
                raise ValueError(('Unrecognized    metric.    Problem    %s    specified    metrics    %s.    Recognized    metrics    are    %s.' % (problem_name, metrics, METRICS_FNS.keys())))
        class_output = (('image' in problem_name) and ('coco' not in problem_name))
        real_output = ('gene_expression' in problem_name)
        if model_hparams.prepend_inputs_to_targets:
            assert (not class_output)
            weights_fn = common_layers.weights_second_part
        elif (class_output or real_output):
            weights_fn = common_layers.weights_all
        else:
            weights_fn = common_layers.weights_nonzero
        for metric in metrics:
            metric_fn = METRICS_FNS[metric]
            problem_metric_fn = make_problem_specific_metric_fn(metric_fn, problem_idx, weights_fn)
            eval_metrics[('metrics-%s/%s' % (problem_name, metric))] = problem_metric_fn
    return {k: tf.contrib.learn.MetricSpec(v, prediction_key='predictions', weight_key='problem_choice') for (k, v) in...