Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
VisualDL
提交
2c399c08
V
VisualDL
项目概览
PaddlePaddle
/
VisualDL
大约 1 年 前同步成功
通知
88
Star
4655
Fork
642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
5
Wiki
分析
仓库
DevOps
项目成员
Pages
V
VisualDL
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
5
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
2c399c08
编写于
7月 19, 2018
作者:
N
Nicky Chan
提交者:
GitHub
7月 19, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add download ONNX model in scratch_log, clean up graph image logic (#473)
上级
66c979ef
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
13 addition
and
29 deletion
+13
-29
demo/vdl_create_scratch_log
demo/vdl_create_scratch_log
+9
-10
visualdl/server/graph.py
visualdl/server/graph.py
+1
-1
visualdl/server/visualdl
visualdl/server/visualdl
+3
-18
未找到文件。
demo/vdl_create_scratch_log
浏览文件 @
2c399c08
...
...
@@ -197,10 +197,9 @@ with logw.mode("train") as logger:
embedding
.
add_embeddings_with_word_dict
(
hot_vectors
,
word_dict
)
def
download_
graph_image
():
def
download_
onnx
():
'''
This is a scratch demo, it do not generate a ONNX proto, but just download an image
that generated before to show how the graph frontend works.
This is a scratch demo, it do not generate a ONNX proto, but just download a prebuilt ONNX file.
For real cases, just refer to README.
'''
...
...
@@ -218,12 +217,12 @@ def download_graph_image():
myssl
=
ssl
.
create_default_context
()
myssl
.
check_hostname
=
False
myssl
.
verify_mode
=
ssl
.
CERT_NONE
image_url
=
"https://github.com/PaddlePaddle/VisualDL/blob/develop/demo/mxnet/super_resolution_graph.png
?raw=true"
log
.
warning
(
'download
graph demo from {}'
.
format
(
image
_url
))
graph_image
=
ur
.
urlopen
(
image
_url
,
context
=
myssl
).
read
()
with
open
(
os
.
path
.
join
(
logdir
,
'
graph.jpg
'
),
'wb'
)
as
f
:
f
.
write
(
graph_image
)
log
.
warning
(
'
graph ready!
'
)
onnx_url
=
"https://github.com/PaddlePaddle/VisualDL/blob/develop/demo/mnist_model.onnx
?raw=true"
log
.
warning
(
'download
ONNX file from {}'
.
format
(
onnx
_url
))
onnx_model
=
ur
.
urlopen
(
onnx
_url
,
context
=
myssl
).
read
()
with
open
(
os
.
path
.
join
(
logdir
,
'
mnist_model.onnx
'
),
'wb'
)
as
f
:
f
.
write
(
onnx_model
)
log
.
warning
(
'
ONNX model ready! use visualdl --logdir=scratch_log -m scratch_log/mnist_model.onnx to launch
'
)
download_
graph_image
()
download_
onnx
()
visualdl/server/graph.py
浏览文件 @
2c399c08
...
...
@@ -486,7 +486,7 @@ class GraphPreviewGenerator(object):
return
self
.
graph
.
edge
(
source
,
target
,
**
kwargs
)
def
draw_graph
(
model_pb_path
,
image_dir
):
def
draw_graph
(
model_pb_path
):
json_str
=
load_model
(
model_pb_path
)
return
json_str
...
...
visualdl/server/visualdl
浏览文件 @
2c399c08
...
...
@@ -299,29 +299,14 @@ def individual_audio():
@
app
.
route
(
'/data/plugin/graphs/graph'
)
def
graph
():
# TODO(daming-lu): rename variables because we switched from static graph generated by graphviz
# to d3/dagre drawn svg
if
graph_image_path
is
not
None
:
data
=
{
'data'
:
graph_image_path
,
}
else
:
image_dir
=
os
.
path
.
join
(
args
.
logdir
,
"graphs"
)
if
not
os
.
path
.
isdir
(
image_dir
):
os
.
mkdir
(
image_dir
)
json_str
=
vdl_graph
.
draw_graph
(
args
.
model_pb
,
image_dir
)
json_str
=
vdl_graph
.
draw_graph
(
args
.
model_pb
)
data
=
{
'data'
:
json_str
}
result
=
gen_result
(
0
,
""
,
data
)
return
Response
(
json
.
dumps
(
result
),
mimetype
=
'application/json'
)
if
__name__
==
'__main__'
:
logger
.
info
(
" port="
+
str
(
args
.
port
))
if
args
.
model_pb
:
# draw graph
image_dir
=
os
.
path
.
join
(
args
.
logdir
,
"graphs"
)
if
not
os
.
path
.
isdir
(
image_dir
):
os
.
mkdir
(
image_dir
)
graph_image_path
=
vdl_graph
.
draw_graph
(
args
.
model_pb
,
image_dir
)
app
.
run
(
debug
=
False
,
host
=
args
.
host
,
port
=
args
.
port
,
threaded
=
True
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录