Skip to content

[🐛BUG] 采用TailPercentage评估模型时报错 #2191

@KRec-create

Description

@KRec-create

当采用TailPercentage指标时,出现如下错误
File "run_recbole.py", line 46, in run(
File "D:\RecBole\recbole\quick_start\quick_start.py", line 52, in run res = run_recbole(
File "D:\RecBole\recbole\quick_start\quick_start.py", line 148, in run_recbole best_valid_score, best_valid_result = trainer.fit(
File "D:\RecBole\recbole\trainer\trainer.py", line 464, in fit valid_score, valid_result = self._valid_epoch(
File "D:\RecBole\recbole\trainer\trainer.py", line 283, in _valid_epoch valid_result = self.evaluate(
File "D:\Anaconda3\Environment\RecBole\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context return func(*args, **kwargs)
File "D:\RecBole\recbole\trainer\trainer.py", line 625, in evaluate struct = self.eval_collector.get_data_struct()
File "D:\RecBole\recbole\evaluator\collector.py", line 227, in get_data_struct self.data_struct._data_dict[key] = self.data_struct._data_dict[key].cpu() AttributeError: 'Counter' object has no attribute 'cpu'
overall.yml的配置如下:

Evaluation Settings

eval_args: # (dict) 4 keys: group_by, order, split, and mode
split: {'RS':[0.8,0.1,0.1]} # (dict) The splitting strategy ranging in ['RS','LS'].
group_by: user # (str) The grouping strategy ranging in ['user', 'none'].
order: RO # (str) The ordering strategy ranging in ['RO', 'TO'].
mode: full # (str) The evaluation mode ranging in ['full','unixxx','popxxx','labeled'].
repeatable: False # (bool) Whether to evaluate results with a repeatable recommendation scene.
metrics: ["TailPercentage"] # (list or str) Evaluation metrics.
topk: [10] # (list or int or None) The value of k for topk evaluation metrics.
valid_metric: TailPercentage@10 # (str) The evaluation metric for early stopping.
valid_metric_bigger: True # (bool) Whether to take a bigger valid metric value as a better result.
eval_batch_size: 4096 # (int) The evaluation batch size.
metric_decimal_place: 4 # (int) The decimal place of metric scores.
**实验环境(请补全下列信息):

  • 操作系统: Windows
  • RecBole 版本 : v1.2.1
  • Python 版本 : 3,8
  • PyTorch 版本 : 2.3.1+cu121
  • cudatoolkit 版本 :

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions