diff --git a/python/examples/imdb/clean_data.sh b/python/examples/imdb/clean_data.sh new file mode 100644 index 0000000000000000000000000000000000000000..6d2c8d7a7ff195f91796483ce8caf9cc5fa0317f --- /dev/null +++ b/python/examples/imdb/clean_data.sh @@ -0,0 +1 @@ +rm -rf imdb.vocab kvdb log *.pyc serving_client_conf serving_server_model test_data text_classification_data.tar.gz train_data work_dir1 diff --git a/python/examples/imdb/local_train.py b/python/examples/imdb/local_train.py index e2c223afb508f03485cde0c4c206bfb63d6ea601..438fb04f112397ee80feb46540b303535b43054f 100644 --- a/python/examples/imdb/local_train.py +++ b/python/examples/imdb/local_train.py @@ -53,7 +53,7 @@ if __name__ == "__main__": exe = fluid.Executor(fluid.CPUPlace()) exe.run(fluid.default_startup_program()) - epochs = 30 + epochs = 6 save_dirname = "cnn_model" import paddle_serving_client.io as serving_io @@ -62,7 +62,7 @@ if __name__ == "__main__": exe.train_from_dataset(program=fluid.default_main_program(), dataset=dataset, debug=False) logger.info("TRAIN --> pass: {}".format(i)) - if i == 20: + if i == 5: serving_io.save_model("serving_server_model", "serving_client_conf", {"words": data, "label": label}, diff --git a/python/examples/imdb/test_client.py b/python/examples/imdb/test_client.py index 0c9ed0cbd7bca5651358735c5d03893530b4e844..891708db941fce65e2272b60e7520d97723da5ce 100644 --- a/python/examples/imdb/test_client.py +++ b/python/examples/imdb/test_client.py @@ -10,8 +10,7 @@ for line in sys.stdin: words = [int(x) for x in group[1:int(group[0]) + 1]] label = [int(group[-1])] feed = {"words": words, "label": label} - fetch = ["cost", "acc", "prediction"] + fetch = ["acc", "cost", "prediction"] fetch_map = client.predict(feed=feed, fetch=fetch) - print(fetch_map) - #print("{} {}".format(fetch_map["prediction"][1], label[0])) + print("{} {}".format(fetch_map["prediction"][1], label[0]))