当我在加载评估指标:rouge时,采用load_metric出现cannot import
这是因为在datasets 3.0.0版本已经移除了这个用法。
在dataset 3.0.0版本之后都采用evaluate.
在使用evaluate的时候,我发现我的conda库中,并没有这个库。
因此,我调出虚拟环境,进行配置。
使用 pip install evaluate
tips: 当我安装好了evaluate之后,又给我报错。
ImportError: To be able to use evaluate-metric/rouge, you need to install the following dependencies['absl', 'rouge_score'] using 'pip install # Here to have a nice missing dependency error message early on rouge_score' for instance'
这里是出现有2个包没有安装。
采用pip install absl-py rouge_score进行安装。
最后成功调用。
2025/2/18 成功解决