# AttributeError: module 'datasets.metric' has no attribute 'compute'

**URL:** <https://discuss.huggingface.co/t/attributeerror-module-datasets-metric-has-no-attribute-compute/68653>\
**Category:** 🤗Transformers\
**Created:** [January 10, 2024, 11:52am UTC](https://discuss.huggingface.co/t/attributeerror-module-datasets-metric-has-no-attribute-compute/68653 "2024-01-10T11:52:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![semihGuner2002](https://avatars.discourse-cdn.com/v4/letter/s/cdc98d/32.png) [@semihGuner2002](https://discuss.huggingface.co/u/semihGuner2002)\
**Post date:** [January 10, 2024, 11:52am UTC](https://discuss.huggingface.co/t/attributeerror-module-datasets-metric-has-no-attribute-compute/68653/1 "2024-01-10T11:52:15Z")

</div>

Hello all.  
I am new with Huggingface. I don’t know what really caused this problem, so I figured that best approach for it to be just asking here. I am having "AttributeError: module ‘datasets.metric’ has no attribute ‘compute’ " on my metric function.

```auto
def compute_metrics(eval_predictions):
    predictions, labels = eval_predictions
    return bertScore.compute(predictions=predictions, references=labels)

evalCallback= KerasMetricCallback(
    metric_fn=compute_metrics, eval_dataset=tf_validation_dataset)

push_to_hub_callback = PushToHubCallback(
    hub_token=hftoken,
    output_dir=dir,
    tokenizer=tokenizer,
    hub_model_id=push_to_hub_model_id,
)

tensorboard_callback = TensorBoard(log_dir="{}/logs".format(dir))

callbacks = [tensorboard_callback, push_to_hub_callback, evalCallback]

model.fit(
    tf_train_dataset,
    validation_data=tf_validation_dataset,
    epochs=num_epochs,
    callbacks=callbacks
)

```

I tried digging into other topics or to the docs, and I couldn’t figure this out. What can I do? Thanks 🙂
