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

[Question]: Taskflow如何指定模型路径,task为information_extraction #9698

Open
liujiachang opened this issue Dec 26, 2024 · 8 comments
Assignees
Labels
question Further information is requested

Comments

@liujiachang
Copy link

请提出你的问题

我通过task_path和home_path设定均会报错

Traceback (most recent call last):
  File "/root/work/filestorage/liujc/paddle/main.py", line 7, in <module>
    model = Taskflow(
  File "/usr/local/lib/python3.10/dist-packages/paddlenlp/taskflow/taskflow.py", line 809, in __init__
    self.task_instance = task_class(
  File "/usr/local/lib/python3.10/dist-packages/paddlenlp/taskflow/information_extraction.py", line 536, in __init__
    self._get_inference_model()
  File "/usr/local/lib/python3.10/dist-packages/paddlenlp/taskflow/task.py", line 372, in _get_inference_model
    self._prepare_static_mode()
  File "/usr/local/lib/python3.10/dist-packages/paddlenlp/taskflow/task.py", line 227, in _prepare_static_mode
    self.predictor = paddle.inference.create_predictor(self._config)
RuntimeError: (Unavailable) Not allowed to load partial data via load_combine_op, please use load_op instead.
  [Hint: Expected buffer->eof() == true, but received buffer->eof():0 != true:1.] (at /paddle/paddle/phi/kernels/impl/load_combine_kernel_impl.h:81)
  [operator < load_combine > error]

而且保存的模型路径中,缺失了inference.pdmodel文件。

@liujiachang liujiachang added the question Further information is requested label Dec 26, 2024
@wawltor
Copy link
Collaborator

wawltor commented Dec 27, 2024

你的paddle是什么版本?

@Decade-rider
Copy link

请提出你的问题

我通过task_path和home_path设定均会报错

Traceback (most recent call last):
  File "/root/work/filestorage/liujc/paddle/main.py", line 7, in <module>
    model = Taskflow(
  File "/usr/local/lib/python3.10/dist-packages/paddlenlp/taskflow/taskflow.py", line 809, in __init__
    self.task_instance = task_class(
  File "/usr/local/lib/python3.10/dist-packages/paddlenlp/taskflow/information_extraction.py", line 536, in __init__
    self._get_inference_model()
  File "/usr/local/lib/python3.10/dist-packages/paddlenlp/taskflow/task.py", line 372, in _get_inference_model
    self._prepare_static_mode()
  File "/usr/local/lib/python3.10/dist-packages/paddlenlp/taskflow/task.py", line 227, in _prepare_static_mode
    self.predictor = paddle.inference.create_predictor(self._config)
RuntimeError: (Unavailable) Not allowed to load partial data via load_combine_op, please use load_op instead.
  [Hint: Expected buffer->eof() == true, but received buffer->eof():0 != true:1.] (at /paddle/paddle/phi/kernels/impl/load_combine_kernel_impl.h:81)
  [operator < load_combine > error]

而且保存的模型路径中,缺失了inference.pdmodel文件。

请问您找到在哪里下载inference.pdmodel文件了吗

@liujiachang
Copy link
Author

paddlepaddle 3.0.0.dev20241225
paddle-custom-npu 3.0.0.dev20241226
paddlenlp 3.0.0b3

通过设置环境变量
export FLAGS_enable_pir_api=0
修复了该问题

@liujiachang
Copy link
Author

请提出你的问题

我通过task_path和home_path设定均会报错

Traceback (most recent call last):
  File "/root/work/filestorage/liujc/paddle/main.py", line 7, in <module>
    model = Taskflow(
  File "/usr/local/lib/python3.10/dist-packages/paddlenlp/taskflow/taskflow.py", line 809, in __init__
    self.task_instance = task_class(
  File "/usr/local/lib/python3.10/dist-packages/paddlenlp/taskflow/information_extraction.py", line 536, in __init__
    self._get_inference_model()
  File "/usr/local/lib/python3.10/dist-packages/paddlenlp/taskflow/task.py", line 372, in _get_inference_model
    self._prepare_static_mode()
  File "/usr/local/lib/python3.10/dist-packages/paddlenlp/taskflow/task.py", line 227, in _prepare_static_mode
    self.predictor = paddle.inference.create_predictor(self._config)
RuntimeError: (Unavailable) Not allowed to load partial data via load_combine_op, please use load_op instead.
  [Hint: Expected buffer->eof() == true, but received buffer->eof():0 != true:1.] (at /paddle/paddle/phi/kernels/impl/load_combine_kernel_impl.h:81)
  [operator < load_combine > error]

而且保存的模型路径中,缺失了inference.pdmodel文件。

请问您找到在哪里下载inference.pdmodel文件了吗

该文件不是下载下来的, static/目录是生成的

@Decade-rider
Copy link

Decade-rider commented Jan 2, 2025 via email

@liujiachang
Copy link
Author

模型文件只有model_state.pdparams,static目录中的inference.pdmodel是运行taskflow代码生成的,他会自动检测你有没有inference.pdmodel这个文件,正常情况没有会主动生成,但是由于某些错误(我通过export FLAGS_enable_pir_api=0修复成功),没有生成,官方应该并没有提供该文件。

@Decade-rider
Copy link

Decade-rider commented Jan 2, 2025 via email

@Decade-rider
Copy link

模型文件只有model_state.pdparams,static目录中的inference.pdmodel是运行taskflow代码生成的,他会自动检测你有没有inference.pdmodel这个文件,正常情况没有会主动生成,但是由于某些错误(我通过export FLAGS_enable_pir_api=0修复成功),没有生成,官方应该并没有提供该文件。
非常感谢,在试了多次无果后,我重新配置了cuda、paddle,现在暂时问题解决了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants