未验证 提交 d7c8f376 编写于 作者: L littletomatodonkey 提交者: GitHub

Merge pull request #241 from littletomatodonkey/update_faq

fix visualdl version bug
......@@ -46,3 +46,8 @@ VALID:
>>
* Q: What should I do if I want to transform the weights' format from `pdparams` to an earlier version(before Paddle1.7.0), which consists of the scattered files?
* A: You can use `fluid.load` to load the `pdparams` weights and use `fluid.io.save_vars` to save the weights as scattered files.
>>
* Q: The error occured when using visualdl under python2, shows that: `TypeError: __init__() missing 1 required positional argument: 'sync_cycle'`.
* A: `Visualdl` is only supported on python3 as now, whose version needs also be higher than `2.0`. If your visualdl version is lower than 2.0, you can also install visualdl 2.0 by `pip3 install visualdl==2.0.0b8 -i https://mirror.baidu.com/pypi/simple`.
......@@ -46,3 +46,8 @@ VALID:
>>
* Q: 如果想将保存的`pdparams`模型参数文件转换为早期版本(Paddle1.7.0之前)的零碎文件(每个文件均为一个单独的模型参数),该怎么实现呢?
* A: 可以首先导入`pdparams`模型,之后使用`fluid.io.save_vars`函数将模型保存为零散的碎文件。
>>
* Q: python2下,使用visualdl的时候,报出以下错误,`TypeError: __init__() missing 1 required positional argument: 'sync_cycle'`,这是为什么呢?
* A: 目前visualdl仅支持在python3下运行,visualdl需要是2.0以上的版本,如果visualdl版本不对的话,可以通过以下方式进行安装:`pip3 install visualdl==2.0.0b8 -i https://mirror.baidu.com/pypi/simple`cd
......@@ -18,6 +18,7 @@ from __future__ import print_function
import argparse
import os
from sys import version_info
import paddle.fluid as fluid
from paddle.fluid.incubate.fleet.base import role_maker
......@@ -101,11 +102,15 @@ def main(args):
compiled_train_prog = fleet.main_program
vdl_writer = None
if args.vdl_dir:
from visualdl import LogWriter
vdl_writer = LogWriter(args.vdl_dir)
else:
vdl_writer = None
if version_info.major == 2:
logger.info(
"visualdl is just supported for python3, so it is disabled in python2..."
)
else:
from visualdl import LogWriter
vdl_writer = LogWriter(args.vdl_dir)
for epoch_id in range(config.epochs):
# 1. train with train dataset
......
......@@ -18,6 +18,7 @@ from __future__ import print_function
import argparse
import os
from sys import version_info
import paddle.fluid as fluid
......@@ -110,11 +111,15 @@ def main(args):
compiled_valid_prog = program.compile(
config, valid_prog, share_prog=compiled_train_prog)
vdl_writer = None
if args.vdl_dir:
from visualdl import LogWriter
vdl_writer = LogWriter(args.vdl_dir)
else:
vdl_writer = None
if version_info.major == 2:
logger.info(
"visualdl is just supported for python3, so it is disabled in python2..."
)
else:
from visualdl import LogWriter
vdl_writer = LogWriter(args.vdl_dir)
for epoch_id in range(config.epochs):
# 1. train with train dataset
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册