提交 35f1dfde 编写于 作者: Q qiaolongfei

chage trainer.save_parameter to trainer.save_parameter_to_tar

上级 68c1efdd
......@@ -29,7 +29,7 @@ def main():
else:
paddle.init(
use_gpu=False,
trainer_count=1,
trainer_count=2,
port=7164,
ports_num=1,
ports_num_for_sparse=1,
......@@ -69,7 +69,7 @@ def main():
def event_handler(event):
if isinstance(event, paddle.event.EndIteration):
if event.batch_id % 100 == 0:
trainer.save_parameter("output", "batch-" + str(event.batch_id))
trainer.save_parameter_to_tar("output", "batch-" + str(event.batch_id))
result = trainer.test(
paddle.batch(
paddle.dataset.imikolov.test(word_dict, N), 32))
......
......@@ -98,7 +98,7 @@ class SGD(object):
self.__gradient_machine__.prefetch(in_args)
self.__parameter_updater__.getParametersRemote()
def save_parameter(self, dir_name, file_name):
def save_parameter_to_tar(self, dir_name, file_name):
if not os.path.exists(dir_name):
os.makedirs(dir_name)
param_file_name = dir_name + "/" + file_name + '.tar.gz'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册