提交 277aae4a 编写于 作者: Z Zeyu Chen

fix creator mkdir issues and add all test for travis-ci

上级 8c83f793
......@@ -20,6 +20,7 @@ import paddle_hub.module_desc_pb2 as modulepb
import paddle.fluid as fluid
from paddle_hub.utils import to_list
from paddle_hub.signature import Signature
from paddle_hub.module import mkdir
import os
......@@ -31,13 +32,12 @@ def create_module(sign_arr, program, path=None, assets=None):
if not path:
path = os.path.join(".", "hub_module")
assert not os.path.exists(path), "path %s should not be existed" % path
# create module path for saving
mkdir(path)
module = modulepb.ModuleDesc()
program = program.clone()
os.makedirs(path)
# TODO(wuzewu): save assets data
if not assets:
module.contain_assets = False
......
test_downloader
test_export_n_load_module
test_module
test_train_w2v
......@@ -92,7 +92,6 @@ def train():
for epoch in range(0, PASS_NUM):
for mini_batch in batch_reader():
# 定义输入变量
feed_var_list = [
main_program.global_block().var("firstw"),
main_program.global_block().var("secondw"),
......@@ -105,9 +104,9 @@ def train():
main_program,
feed=feeder.feed(mini_batch),
fetch_list=[avg_cost])
print("Cost = %f" % cost[0])
print("Epoch {} Cost = {}".format(epoch, cost[0]))
model_dir = "./w2v_model"
model_dir = "./tmp/w2v_model"
var_list_to_saved = [main_program.global_block().var("embedding")]
print("saving model to %s" % model_dir)
fluid.io.save_vars(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册