Repository: huggingface/evaluate
Issue: Huggingface bertscore metric GPU leak?
Root cause: Resource Mishandling

I'm using bertscore as a metric for my project, and I'm getting a GPU leak that I can't understand. I've been able to reproduce the issue with this simple script, looking at GPU usage on my GPU.

Evaluate version is 0.2.2, python=3.8.

```python
import evaluate

predictions = ['a' for _ in range(30)]
references = ['b' for _ in range(30)]

# nvidia-smi output
# Sat Apr 29 12:25:16 2023       
# +-----------------------------------------------------------------------------+
# | NVIDIA-SMI 510.108.03   Driver Version: 510.108.03   CUDA Version: 11.6     |
# |-------------------------------+----------------------+----------------------+
# | GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
# | Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
# |                               |                      |               MIG M. |
# |===============================+======================+======================|
# |   0  NVIDIA GeForce ...  Off  | 00000000:07:00.0 Off |                  N/A |
# | N/A   41C    P8     2W /  N/A |   1356MiB /  8192MiB |      1%      Default |
# |                               |                      |                  N/A |
# +-------------------------------+----------------------+----------------------+
# ... 
# nothing for python

bertscore = evaluate.load("bertscore")
scores = bertscore.compute(predictions=predictions, references=references, lang='en', batch_size=64)['f1']

# nvidia-smi output:
# +-----------------------------------------------------------------------------+
# | NVIDIA-SMI 510.108.03   Driver Version: 510.108.03   CUDA Version: 11.6     |
# |-------------------------------+----------------------+----------------------+
# | GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
# | Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
# |                               |                      |               MIG M. |
# |===============================+======================+======================|
# |   0  NVIDIA GeForce ...  Off  | 00000000:07:00.0 Off |                  N/A |
# | N/A   41C    P8     2W /  N/A |   3106MiB /  8192MiB |      1%      Default |
# |                               |                      |                  N/A |
# +-------------------------------+----------------------+----------------------+
# ...
# |    0   N/A  N/A   1087985      C   python                           1751MiB |
# +-----------------------------------------------------------------------------+

del scores
del bertscore

# nvidia-smi output:
# +-----------------------------------------------------------------------------+
# | NVIDIA-SMI 510.108.03   Driver Version: 510.108.03   CUDA Version: 11.6     |
# |-------------------------------+----------------------+----------------------+
# | GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
# | Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
# |                               |                      |               MIG M. |
# |===============================+======================+======================|
# |   0  NVIDIA GeForce ...  Off  | 00000000:07:00.0 Off |                  N/A |
# | N/A   41C    P8     2W /  N/A |   3106MiB /  8192MiB |      1%      Default |
# |                               |                      |                  N/A |
# +-------------------------------+----------------------+----------------------+
# ...
# |    0   N/A  N/A   1087985      C   python                           1751MiB |
# +-----------------------------------------------------------------------------+
```

Does anyone know what's causing this issue? I'm expecting the GPU utilisation to go down after deleting both the scores and the model.