Huggingface bertscore 公制 GPU 泄漏?

问题描述 投票:0回答:0

我使用 bertscore 作为我的项目的指标,我遇到了一个我无法理解的 GPU 泄漏。我已经能够用这个简单的脚本重现这个问题,查看我的 GPU 上的 GPU 使用情况。

评估版本为0.2.2,python=3.8.

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 |
# +-----------------------------------------------------------------------------+

有谁知道是什么导致了这个问题?我预计在删除分数和模型后 GPU 利用率会下降。

python gpu evaluate huggingface
© www.soinside.com 2019 - 2024. All rights reserved.