huggingface / huggingface/evaluate

Evaluation of empty strings with MAUVE results in error

Open
#593 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2.5k
Forks
341
PR merge metrics
No merged PRs in 30d

Description

Hi, I'm currently using HF wrapper to evaluate strings with MAUVE: https://huggingface.co/spaces/evaluate-metric/mauve

I'm getting the following an error when passing empty strings (e.g. `""`). Is this an expected behavior? I would think that the empty string could be considered a valid string and therefore could be evaluated with MAUVE?

```
File "src/main.py", line 194, in
main()
File "src/main.py", line 185, in main
mauve_results_local, mauve_results_global = evaluate(
File "/mnt/aiongpfs/projects/ai-art/global-decoding/global-decoding/src/eval/evaluate.py", line 58, in evaluate
mauve_results_global = mauve.compute(
File "/mnt/aiongpfs/projects/ai-art/global-decoding/lib/python3.8/site-packages/evaluate/module.py", line 462, in compute
output = self._compute(**inputs, **compute_kwargs)
File "/home/users/dgareev/.cache/huggingface/modules/evaluate_modules/metrics/evaluate-metric--mauve/653f4690bcc6e9e16df42f9f85bd0f1b59cca1ae2864058dceedc595f26f6705/mauve.py", line 136, in _compute
out = compute_mauve(
File "/mnt/aiongpfs/projects/ai-art/global-decoding/lib/python3.8/site-packages/mauve/compute_mauve.py", line 87, in compute_mauve
p_features = get_features_from_input(
File "/mnt/aiongpfs/projects/ai-art/global-decoding/lib/python3.8/site-packages/mauve/compute_mauve.py", line 176, in get_features_from_input
features = featurize_tokens_from_model(MODEL, tokenized_texts, batch_size, name).detach().cpu().numpy()
File "/mnt/aiongpfs/projects/ai-art/global-decoding/lib/python3.8/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/mnt/aiongpfs/projects/ai-art/global-decoding/lib/python3.8/site-packages/mauve/utils.py", line 114, in featurize_tokens_from_model
outs = model(input_ids=padded_chunk,
File "/mnt/aiongpfs/projects/ai-art/global-decoding/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/mnt/aiongpfs/projects/ai-art/global-decoding/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
File "/mnt/aiongpfs/projects/ai-art/global-decoding/lib/python3.8/site-packages/transformers/models/gpt2/modeling_gpt2.py", line 777, in forward
input_ids = input_ids.view(-1, input_shape[-1])
RuntimeError: cannot reshape tensor of 0 elements into shape [-1, 0] because the unspecified dimension size -1 can be any value and is ambiguous
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.