yourh / AttentionXML

Implementation for "AttentionXML: Label Tree-based Attention-Aware Deep Model for High-Performance Extreme Multi-Label Text Classification"
245 stars 41 forks source link

执行命令过程的报错问题 #26

Closed Chanchiuhung closed 2 years ago

Chanchiuhung commented 2 years ago

您好!我在执行“python main.py --data-cnf configure/datasets/EUR-Lex.yaml --model-cnf configure/models/AttentionXML-EUR-Lex.yaml”的时候会显示报错为 /home/jupyter-chanchiuhung/AttentionXML/deepxml/optimizers.py:108: UserWarning: This overload of add is deprecated: add(Number alpha, Tensor other) Consider using one of the following signatures instead: add_(Tensor other, , Number alpha) (Triggered internally at ../torch/csrc/utils/python_arg_parser.cpp:1050.) expavg.mul(beta1).add_(1 - beta1, grad) Traceback (most recent call last): File "/home/jupyter-chanchiuhung/AttentionXML/main.py", line 95, in main() File "/home/jupyter-chanchiuhung/.local/lib/python3.9/site-packages/click/core.py", line 1128, in call return self.main(args, kwargs) File "/home/jupyter-chanchiuhung/.local/lib/python3.9/site-packages/click/core.py", line 1053, in main rv = self.invoke(ctx) File "/home/jupyter-chanchiuhung/.local/lib/python3.9/site-packages/click/core.py", line 1395, in invoke return ctx.invoke(self.callback, ctx.params) File "/home/jupyter-chanchiuhung/.local/lib/python3.9/site-packages/click/core.py", line 754, in invoke return __callback(*args, kwargs) File "/home/jupyter-chanchiuhung/AttentionXML/main.py", line 64, in main model.train(train_loader, valid_loader, model_cnf['train']) File "/home/jupyter-chanchiuhung/AttentionXML/deepxml/models.py", line 73, in train p5, n5 = get_p_5(labels, targets), get_n_5(labels, targets) File "/home/jupyter-chanchiuhung/AttentionXML/deepxml/evaluation.py", line 42, in get_precision mlb = get_mlb(classes, mlb, targets) File "/home/jupyter-chanchiuhung/AttentionXML/deepxml/evaluation.py", line 33, in get_mlb mlb = MultiLabelBinarizer(range(targets.shape[1]), sparse_output=True) TypeError: init() takes 1 positional argument but 2 positional arguments (and 1 keyword-only argument) were given 请问这是为什么呀?

yourh commented 2 years ago

应该是sklearn版本太新了,如果要用新版的sklearn这里要稍微改写一下。

Chanchiuhung commented 2 years ago

应该是sklearn版本太新了,如果要用新版的sklearn这里要稍微改写一下。

好的,谢谢解答!