Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: 进行情感分析时提示找不到 _static_json_file 对象 #9937

Open
1 task done
wojiaoyishang opened this issue Feb 24, 2025 · 1 comment
Open
1 task done
Assignees
Labels
bug Something isn't working

Comments

@wojiaoyishang
Copy link

软件环境

- paddlepaddle-gpu: 3.0.0rc1
- paddlenlp:  3.0.0b3.post20250223

重复问题

  • I have searched the existing issues

错误描述

Traceback (most recent call last):
  File "E:\Programming\Python\ComfyUI\execution.py", line 327, in execute
    output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Programming\Python\ComfyUI\execution.py", line 202, in get_output_data
    return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Programming\Python\ComfyUI\custom_nodes\Comfyui_MindFlow\__init__.py", line 90, in _map_node_over_list_patching
    r = _map_node_over_list(*args, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Programming\Python\ComfyUI\execution.py", line 174, in _map_node_over_list
    process_inputs(input_dict, i)
  File "E:\Programming\Python\ComfyUI\execution.py", line 163, in process_inputs
    results.append(getattr(obj, func)(**inputs))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Programming\Python\ComfyUI\custom_nodes\Comfyui_MindFlow\nodes\Text\PaddleNLP.py", line 36, in function
    senta = Taskflow("sentiment_analysis", model="uie-senta-base", schema=["情感倾向[正向, 负向]"])
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Programming\Python\ComfyUI\venv\Lib\site-packages\paddlenlp\taskflow\taskflow.py", line 869, in __init__
    self.task_instance = task_class(
                         ^^^^^^^^^^^
  File "E:\Programming\Python\ComfyUI\venv\Lib\site-packages\paddlenlp\taskflow\sentiment_analysis.py", line 503, in __init__
    self._get_inference_model()
  File "E:\Programming\Python\ComfyUI\venv\Lib\site-packages\paddlenlp\taskflow\task.py", line 402, in _get_inference_model
    self._config = paddle.inference.Config(self._static_json_file, self._static_params_file)
                                           ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'UIESentaTask' object has no attribute '_static_json_file'

稳定复现步骤 & 代码

复现方法

  1. 设置 NLP 模型自定义保存位置(修改环境变量 PPNLP_HOME)
  2. 进行情感分析
from paddlenlp import Taskflow

schema = ["情感倾向[正向, 负向]"]
senta = Taskflow("sentiment_analysis", model="uie-senta-base", schema=schema)

print(senta(["这个糖的味道不错", "视频做的并不好"]))

报错内容

Image

定位代码位置

问题来自 paddlenlp/taskflow/task.py ,

Image

注意到已合并的 PR #9822 中有定义 _static_json_file 部分(但是不属于 PaddleNLP 下了,估计是失误在合并之前修改了):

Image

@DrownFish19
Copy link
Collaborator

DrownFish19 commented Feb 24, 2025

感谢提PR,我们已经在整体修复 #9930

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants