PaddlePaddle/VisualDL

运行官方的代码出现Failed to save model graph, error: ''

wulispa opened this issue · 12 comments

VisualDL是2.5.1
paddle是2.4.2

是demo的代码吗

是的

是demo的代码吗

图片
有生成文件

运行graph_test.py成功了应该有一个vdlgraph.xxxxx.log的文件,我刚刚跑了一下我这里没有报错,你那边有没有更详细的错误信息给报出来

比如报错的程序堆栈具体在哪一行可以看得到吗

图片
这个嘛

# Copyright (c) 2022 VisualDL Authors. All Rights Reserve.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# =======================================================================
import paddle
import paddle.nn as nn
import paddle.nn.functional as F

from visualdl import LogWriter


class MyNet(nn.Layer):
    def __init__(self):
        super(MyNet, self).__init__()
        self.conv1 = nn.Conv2D(
            in_channels=1, out_channels=20, kernel_size=5, stride=1, padding=2)
        self.max_pool1 = nn.MaxPool2D(kernel_size=2, stride=2)
        self.conv2 = nn.Conv2D(
            in_channels=20,
            out_channels=20,
            kernel_size=5,
            stride=1,
            padding=2)
        self.max_pool2 = nn.MaxPool2D(kernel_size=2, stride=2)
        self.fc = nn.Linear(in_features=980, out_features=10)

    def forward(self, inputs):
        x = self.conv1(inputs)
        x = F.relu(x)
        x = self.max_pool1(x)
        x = self.conv2(x)
        x = F.relu(x)
        x = self.max_pool2(x)
        x = paddle.reshape(x, [x.shape[0], -1])
        x = self.fc(x)
        return x


net = MyNet()
with LogWriter(logdir="./log/graph_test/") as writer:
    writer.add_graph(
        model=net,
        input_spec=[paddle.static.InputSpec([-1, 1, 28, 28], 'float32')],
        verbose=True)

是跑的这份代码吗

是的

不清楚原因,等我找一台windows机器复现后回你

我也有这个问题,我这样解决了https://github.com/PaddlePaddle/VisualDL/pull/1233,我也是windows

可以了,谢谢哇

修复的pr #1244 。 这个修复将在下一个小版本中进入,如果需要在windows下使用,可以参考这个pr中修改的文件在本地对应修改一下。具体可以安装如下操作:
import visualdl
visualdl.path
看一下visualdl的安装路径,然后找到pr中修改的文件对应修改一下即能够生效。