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

静态图导出缺失文件 #69631

Open
yimuu opened this issue Nov 22, 2024 · 1 comment
Open

静态图导出缺失文件 #69631

yimuu opened this issue Nov 22, 2024 · 1 comment

Comments

@yimuu
Copy link

yimuu commented Nov 22, 2024

bug描述 Describe the Bug

静态图导出缺失.pdmodel文件
paddle版本:3.0.0.dev20241120

import paddle
import paddle.nn as nn

IMAGE_SIZE = 784 
CLASS_NUM = 10

class LinearNet(nn.Layer):
    def __init__(self):
        super().__init__()
        self._linear = nn.Linear(IMAGE_SIZE, CLASS_NUM)
    # 规范写法,forward 中仅实现预测功能
    @paddle.jit.to_static
    def forward(self, x): 
        return self._linear(x)

l = LinearNet()
paddle.jit.save(l, ".", [paddle.static.InputSpec(shape=[None, 784], dtype="float32", name="penalty_score")])

生成的文件只有pdiparams

其他补充信息 Additional Supplementary Information

No response

@changeyoung98
Copy link
Contributor

是不是默认开启了PIR模式?PIR模式下以新的序列化协议进行存储,存储model文件是.json文件,参数不变。如果想以旧IR模式存储.pdmodel需要执行 FLAGS_enable_pir_api=0 切换到旧IR。

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

2 participants