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

使用export_model导出SDMGR模型失败 #13556

Open
3 of 4 tasks
TrioTea opened this issue Jul 31, 2024 · 10 comments
Open
3 of 4 tasks

使用export_model导出SDMGR模型失败 #13556

TrioTea opened this issue Jul 31, 2024 · 10 comments
Labels
bug Something isn't working need more info Need more information to locate question

Comments

@TrioTea
Copy link

TrioTea commented Jul 31, 2024

Search before asking

  • I have searched the PaddleOCR Docs and found no similar bug report.

  • I have searched the PaddleOCR Issues and found no similar bug report.

  • I have searched the PaddleOCR Discussions and found no similar bug report.

Bug

模型的训练、评估和预测均正常运行

(haobin_paddle_ocr_env) (base) [root@localhost PaddleOCR]# python3 tools/export_model.py -c output/kie_60/config.yml -o Architecture.Backbone.checkpoints=output/kie_60/best_accuracy
ERROR:albumentations.check_version:Error fetching version info
Traceback (most recent call last):
  File "/root/anaconda3/envs/haobin_paddle_ocr_env/lib/python3.8/site-packages/albumentations/check_version.py", line 32, in fetch_version_info
    data = response.read()
  File "/root/anaconda3/envs/haobin_paddle_ocr_env/lib/python3.8/http/client.py", line 472, in read
    s = self._safe_read(self.length)
  File "/root/anaconda3/envs/haobin_paddle_ocr_env/lib/python3.8/http/client.py", line 613, in _safe_read
    data = self.fp.read(amt)
  File "/root/anaconda3/envs/haobin_paddle_ocr_env/lib/python3.8/socket.py", line 669, in readinto
    return self._sock.recv_into(b)
  File "/root/anaconda3/envs/haobin_paddle_ocr_env/lib/python3.8/ssl.py", line 1274, in recv_into
    return self.read(nbytes, buffer)
  File "/root/anaconda3/envs/haobin_paddle_ocr_env/lib/python3.8/ssl.py", line 1132, in read
    return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
W0731 17:03:00.388967 42736 gpu_resources.cc:119] Please NOTE: device: 0, GPU Compute Capability: 7.5, Driver API Version: 12.4, Runtime API Version: 11.8
W0731 17:03:00.390235 42736 gpu_resources.cc:164] device: 0, cuDNN Version: 8.9.
[2024/07/31 17:03:00] ppocr INFO: train from scratch
Traceback (most recent call last):
  File "tools/export_model.py", line 300, in <module>
    main()
  File "tools/export_model.py", line 294, in main
    export_single_model(
  File "tools/export_model.py", line 197, in export_single_model
    paddle.jit.save(model, save_path)
  File "/root/anaconda3/envs/haobin_paddle_ocr_env/lib/python3.8/site-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "/root/anaconda3/envs/haobin_paddle_ocr_env/lib/python3.8/site-packages/paddle/base/wrapped_decorator.py", line 26, in __impl__
    return wrapped_func(*args, **kwargs)
  File "/root/anaconda3/envs/haobin_paddle_ocr_env/lib/python3.8/site-packages/paddle/jit/api.py", line 809, in wrapper
    func(layer, path, input_spec, **configs)
  File "/root/anaconda3/envs/haobin_paddle_ocr_env/lib/python3.8/site-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "/root/anaconda3/envs/haobin_paddle_ocr_env/lib/python3.8/site-packages/paddle/base/wrapped_decorator.py", line 26, in __impl__
    return wrapped_func(*args, **kwargs)
  File "/root/anaconda3/envs/haobin_paddle_ocr_env/lib/python3.8/site-packages/paddle/base/dygraph/base.py", line 68, in __impl__
    return func(*args, **kwargs)
  File "/root/anaconda3/envs/haobin_paddle_ocr_env/lib/python3.8/site-packages/paddle/jit/api.py", line 1104, in save
    static_func.concrete_program_specify_input_spec(
  File "/root/anaconda3/envs/haobin_paddle_ocr_env/lib/python3.8/site-packages/paddle/jit/dy2static/program_translator.py", line 986, in concrete_program_specify_input_spec
    concrete_program, _ = self.get_concrete_program(
  File "/root/anaconda3/envs/haobin_paddle_ocr_env/lib/python3.8/site-packages/paddle/jit/dy2static/program_translator.py", line 875, in get_concrete_program
    concrete_program, partial_program_layer = self._program_cache[
  File "/root/anaconda3/envs/haobin_paddle_ocr_env/lib/python3.8/site-packages/paddle/jit/dy2static/program_translator.py", line 1648, in __getitem__
    self._caches[item_id] = self._build_once(item)
  File "/root/anaconda3/envs/haobin_paddle_ocr_env/lib/python3.8/site-packages/paddle/jit/dy2static/program_translator.py", line 1575, in _build_once
    concrete_program = ConcreteProgram.from_func_spec(
  File "/root/anaconda3/envs/haobin_paddle_ocr_env/lib/python3.8/site-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "/root/anaconda3/envs/haobin_paddle_ocr_env/lib/python3.8/site-packages/paddle/base/wrapped_decorator.py", line 26, in __impl__
    return wrapped_func(*args, **kwargs)
  File "/root/anaconda3/envs/haobin_paddle_ocr_env/lib/python3.8/site-packages/paddle/base/dygraph/base.py", line 68, in __impl__
    return func(*args, **kwargs)
  File "/root/anaconda3/envs/haobin_paddle_ocr_env/lib/python3.8/site-packages/paddle/jit/dy2static/program_translator.py", line 1346, in from_func_spec
    error_data.raise_new_exception()
  File "/root/anaconda3/envs/haobin_paddle_ocr_env/lib/python3.8/site-packages/paddle/jit/dy2static/error.py", line 452, in raise_new_exception
    raise new_exception from None
AttributeError: In transformed code:

    File "/haobin/code_repo/PaddleOCR/ppocr/modeling/architectures/base_model.py", line 84, in forward
        if self.use_backbone:
    File "/haobin/code_repo/PaddleOCR/ppocr/modeling/architectures/base_model.py", line 85, in forward
        x = self.backbone(x)
    File "/haobin/code_repo/PaddleOCR/ppocr/modeling/backbones/kie_unet_sdmgr.py", line 190, in forward
        img, relations, texts, gt_bboxes = self.pre_process(
    File "/haobin/code_repo/PaddleOCR/ppocr/modeling/backbones/kie_unet_sdmgr.py", line 156, in pre_process
        def pre_process(self, img, relations, texts, gt_bboxes, tag, img_size):
            img, relations, texts, gt_bboxes, tag, img_size = (
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
                img.numpy(),
                relations.numpy(),


    AttributeError: 'Variable' object has no attribute 'tolist'

(haobin_paddle_ocr_env) (base) [root@localhost PaddleOCR]# 

Environment

  • 使用的是CentOS 7.9
  • 使用conda构建的python3.8
  • CUDA 12.4 cudnn 8.9
  • paddle及其余依赖版本均使用的最新

Minimal Reproducible Example

No response

Additional

No response

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!
@TrioTea TrioTea added the bug Something isn't working label Jul 31, 2024
@SWHL SWHL added the need more info Need more information to locate question label Jul 31, 2024
@SWHL
Copy link
Collaborator

SWHL commented Jul 31, 2024

需要提供具体环境信息,也就是Environment

@TrioTea
Copy link
Author

TrioTea commented Aug 1, 2024

需要提供具体环境信息,明确环境

你好,我添加了环境的描述

@SWHL
Copy link
Collaborator

SWHL commented Aug 1, 2024

从提供信息来看,似乎是前处理有问题。需要你这里再仔细debug一下具体是哪里导致的。我这里看着是不能复现。

@GreatV
Copy link
Collaborator

GreatV commented Aug 1, 2024

有些模型目前不支持导出静态图,需要修改模型结构。建议去paddle框架仓库提一个issue。

@TrioTea
Copy link
Author

TrioTea commented Aug 1, 2024

从提供信息来看,似乎是前处理有问题。需要你这里再仔细debug一下具体是哪里导致的。我这里看着是不能复现。

我尝试使用wildreceipt数据集进行训练后尝试导出成推理模型,也遇到了同样的错误

@SWHL
Copy link
Collaborator

SWHL commented Aug 1, 2024

试试导出官方提供的模型呢?

@TrioTea
Copy link
Author

TrioTea commented Aug 1, 2024

@TrioTea
Copy link
Author

TrioTea commented Aug 1, 2024

有些模型目前不支持导出静态图,需要修改模型结构。建议去paddle框架仓库提一个issue。

尝试了paddle 3.0的beta版,问题暂时也还没有解决

@GreatV
Copy link
Collaborator

GreatV commented Aug 1, 2024

@TeaWu 这个得修改模型代码,或者等待paddle框架适配。参考 https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/jit/limitations_cn.html

@TrioTea
Copy link
Author

TrioTea commented Aug 1, 2024

@TeaWu这个得修改模型代码,或者等待paddle框架装备。参考https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/jit/limitations_cn.html

试了一下修改模型的代码,对我来说难度比较大,一直没成功

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

No branches or pull requests

3 participants