未验证 提交 6d9efb96 编写于 作者: T tianxin 提交者: GitHub

Merge pull request #125 from Steffy-zxf/define-epoch-id

Add the difination epoch_id before its reference
...@@ -9,6 +9,7 @@ import paddle.fluid as fluid ...@@ -9,6 +9,7 @@ import paddle.fluid as fluid
from paddle.fluid.initializer import NormalInitializer from paddle.fluid.initializer import NormalInitializer
import paddle.fluid.layers as layers import paddle.fluid.layers as layers
from bilm import elmo_encoder from bilm import elmo_encoder
import ipdb
def lex_net(args, word_dict_len, label_dict_len): def lex_net(args, word_dict_len, label_dict_len):
......
...@@ -555,6 +555,7 @@ def train_loop(args, ...@@ -555,6 +555,7 @@ def train_loop(args,
valid_ppl = eval(vocab, infer_progs, dev_count, logger, args) valid_ppl = eval(vocab, infer_progs, dev_count, logger, args)
logger.info("valid ppl {}".format(valid_ppl)) logger.info("valid ppl {}".format(valid_ppl))
if batch_id > 0 and batch_id % args.save_interval == 0: if batch_id > 0 and batch_id % args.save_interval == 0:
epoch_id = int(batch_id / n_batches_per_epoch)
model_path = os.path.join(args.para_save_dir, model_path = os.path.join(args.para_save_dir,
str(batch_id + epoch_id)) str(batch_id + epoch_id))
if not os.path.isdir(model_path): if not os.path.isdir(model_path):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册