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

AttributeError: 'paddle.base.libpaddle.AnalysisConfig' object has no attribute 'set_optimization_level'. Did you mean: 'tensorrt_optimization_level'? #2546

Closed
Yt-nn opened this issue Nov 25, 2024 · 2 comments

Comments

@Yt-nn
Copy link

Yt-nn commented Nov 25, 2024

您好!我使用版面区域检测模块时,遇到下面的问题

教程

https://paddlepaddle.github.io/PaddleX/latest/module_usage/tutorials/ocr_modules/layout_detection.html#_3

描述问题

运行:
from paddlex import create_model

model_name = "PicoDet-L_layout_3cls"

model = create_model(model_name)
output = model.predict("layout.jpg", batch_size=1)

for res in output:
res.print(json_format=False)
res.save_to_img("./output/")
res.save_to_json("./output/res.json")

报错:
Traceback (most recent call last):
File "D:\pycharm\pythonProject\partOne\paddleX_prog\main.py", line 5, in
model = create_model(model_name)
File "d:\gitclone\paddlex\paddlex\model.py", line 29, in create_model
return _ModelBasedInference(model, *args, **kwargs)
File "d:\gitclone\paddlex\paddlex\model.py", line 57, in init
self.predictor = create_predictor(*args, **kwargs)
File "d:\gitclone\paddlex\paddlex\inference\models_init
.py", line 88, in create_predictor
return BasicPredictor.get(model_name)(
File "d:\gitclone\paddlex\paddlex\inference\models\base\basic_predictor.py", line 47, in init
self._build_components()
File "d:\gitclone\paddlex\paddlex\inference\models\object_detection.py", line 41, in _build_components
predictor = ImageDetPredictor(
File "d:\gitclone\paddlex\paddlex\inference\components\paddle_predictor\predictor.py", line 73, in init
self._update_option(option)
File "d:\gitclone\paddlex\paddlex\inference\components\paddle_predictor\predictor.py", line 80, in _update_option
self._reset()
File "d:\gitclone\paddlex\paddlex\inference\components\paddle_predictor\predictor.py", line 98, in _reset
) = self._create()
File "d:\gitclone\paddlex\paddlex\inference\components\paddle_predictor\predictor.py", line 187, in _create
config.set_optimization_level(3)
AttributeError: 'paddle.base.libpaddle.AnalysisConfig' object has no attribute 'set_optimization_level'. Did you mean: 'tensorrt_optimization_level'?

复现

  1. 已经按照提供的教程安装依赖库
  2. 未修改代码

环境

  1. paddlepaddle-2.6.2;paddlex-3.0.0b2
  2. 操作系统为Windows
  3. Python版本为3.10.15
  4. cpu运行
@zhangyubo0722
Copy link
Collaborator

将paddlepaddle版本升级为3.0 beta2尝试下呢

@TingquanGao
Copy link
Collaborator

The issue has no response for a long time and will be closed. You can reopen or new another issue if are still confused.


From Bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants