diff --git a/python/paddle/fluid/tests/book/word2vec/no_test_word2vec_new_api.py b/python/paddle/fluid/tests/book/word2vec/no_test_word2vec_new_api.py index 1e31824aa1edcb432286563a027c778152a97e74..272db7b5739b0388201a5e14293c2f076c31ad69 100644 --- a/python/paddle/fluid/tests/book/word2vec/no_test_word2vec_new_api.py +++ b/python/paddle/fluid/tests/book/word2vec/no_test_word2vec_new_api.py @@ -94,7 +94,7 @@ def train(use_cuda, is_sparse, save_path): place = fluid.CUDAPlace(0) if use_cuda else fluid.CPUPlace() def event_handler(event): - if isinstance(event, fluid.EndPass): + if isinstance(event, fluid.Event.END_EPOCH): avg_cost = trainer.test(reader=paddle.dataset.imikolov.test( word_dict, N)) @@ -106,10 +106,9 @@ def train(use_cuda, is_sparse, save_path): trainer = fluid.Trainer( partial(inference_network, is_sparse), - optimizer=fluid.optimizer.SGD(learning_rate=0.001), - place=place, - event_handler=event_handler) - trainer.train(train_reader, 100) + fluid.optimizer.SGD(learning_rate=0.001), + place=place) + trainer.train(train_reader, 100, event_handler) def infer(use_cuda, save_path):