运行官方的代码出现Failed to save model graph, error: ''
wulispa opened this issue · 12 comments
wulispa commented
VisualDL是2.5.1
paddle是2.4.2
rainyfly commented
是demo的代码吗
wulispa commented
是的
wulispa commented
rainyfly commented
运行graph_test.py成功了应该有一个vdlgraph.xxxxx.log的文件,我刚刚跑了一下我这里没有报错,你那边有没有更详细的错误信息给报出来
rainyfly commented
比如报错的程序堆栈具体在哪一行可以看得到吗
wulispa commented
rainyfly commented
# 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)
是跑的这份代码吗
wulispa commented
是的
rainyfly commented
不清楚原因,等我找一台windows机器复现后回你
GuoQuanhao commented
wulispa commented
我也有这个问题,我这样解决了https://github.com/PaddlePaddle/VisualDL/pull/1233,我也是windows
可以了,谢谢哇