Skip to content

ner使用过程出现IndexError: list index out of range #2389

Open

Description

@EricHuang7

欢迎您反馈PaddleNLP使用问题,非常感谢您对PaddleNLP的贡献!
在留下您的问题时,辛苦您同步提供如下信息:

  • 版本、环境信息
    1)PaddleNLP和PaddlePaddle版本:请提供您的PaddleNLP和PaddlePaddle版本号,例如PaddleNLP 2.0.4,PaddlePaddle2.1.1
    2)系统环境:请您描述系统类型,例如Linux/Windows/MacOS/,python版本
  • 复现信息:如为报错,请给出复现环境、复现步骤
    版本信息:
    paddlenlp 2.2.3
    paddlepaddle-gpu 2.3.0.post101
    系统环境:
    Linux ; Python 3.7.12
    复现:
    from paddlenlp import Taskflow
    ner = Taskflow("ner", entity_only=True)
    ner("搞笑尼斯湖怪物玩蓝色风笛卡车司机帽")
    ner("蜜蜡迷你蜂巢誓言蜡烛-4支蜡烛礼盒-森林图像")
    报错:
    Traceback (most recent call last):
    File "paddle_test.py", line 5, in
    ner("蜜蜡迷你蜂巢誓言蜡烛-4支蜡烛礼盒-森林图像")
    File "/opt/conda/lib/python3.7/site-packages/paddlenlp/taskflow/taskflow.py", line 244, in call
    results = self.task_instance(inputs)
    File "/opt/conda/lib/python3.7/site-packages/paddlenlp/taskflow/task.py", line 171, in call
    results = self._postprocess(outputs)
    File "/opt/conda/lib/python3.7/site-packages/paddlenlp/taskflow/named_entity_recognition.py", line 145, in _postprocess
    inputs['all_pred_tags'])
    File "/opt/conda/lib/python3.7/site-packages/paddlenlp/taskflow/named_entity_recognition.py", line 87, in _decode
    tags_out.append(tag.split('-')[1])
    IndexError: list index out of range

Activity

  1. wawltor commented on Jun 2, 2022

    @wawltor
    Collaborator

    建议升级到最新PaddleNLP的版本,看了一下这个bug已经修复了,谢谢您给我们指出问题!
    pip install paddlenlp --upgrade

  2. self-assigned this
    on Jun 2, 2022
  3. github-actions commented on Dec 24, 2022

    @github-actions

    This issue is stale because it has been open for 60 days with no activity. 当前issue 60天内无活动,被标记为stale。

  4. EricHuang7 commented on Dec 24, 2022

    @EricHuang7
    Author
  5. github-actions commented on Feb 24, 2023

    @github-actions

    This issue is stale because it has been open for 60 days with no activity. 当前issue 60天内无活动,被标记为stale。

  6. EricHuang7 commented on Feb 24, 2023

    @EricHuang7
    Author
  7. github-actions commented on Apr 27, 2023

    @github-actions

    This issue is stale because it has been open for 60 days with no activity. 当前issue 60天内无活动,被标记为stale。

  8. EricHuang7 commented on Apr 27, 2023

    @EricHuang7
    Author
  9. github-actions commented on Jun 27, 2023

    @github-actions

    This issue is stale because it has been open for 60 days with no activity. 当前issue 60天内无活动,被标记为stale。

  10. 40 remaining items

  11. EricHuang7 commented on Apr 20, 2026

    @EricHuang7
    Author
  12. github-actions commented on Jun 20, 2026

    @github-actions

    This issue is stale because it has been open for 60 days with no activity. 当前issue 60天内无活动,被标记为stale。

  13. EricHuang7 commented on Jun 20, 2026

    @EricHuang7
    Author
  14. github-actions commented on Aug 20, 2026

    @github-actions

    This issue is stale because it has been open for 60 days with no activity. 当前issue 60天内无活动,被标记为stale。

  15. EricHuang7 commented on Aug 20, 2026

    @EricHuang7
    Author
  16. github-actions commented on Oct 21, 2026

    @github-actions

    This issue is stale because it has been open for 60 days with no activity. 当前issue 60天内无活动,被标记为stale。

  17. EricHuang7 commented on Oct 21, 2026

    @EricHuang7
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions