提交 15174e84 编写于 作者: D Dilyar 提交者: Yibing Liu

fix unicode python3 compatable for simnet (#3770)

* Add files via upload

* Delete unicom_compute_pos_neg.py

* Delete unicom_split.py

* Add files via upload

* Update README.md

* Delete reader.py

* Delete run.sh

* Delete run_classifier.py

* Delete utils.py

* Add files via upload

* Update config.py

* Update run.sh

* Update run_classifier.py

* Update download.py

* Update download.py

* Update run_classifier.py

* Update run_classifier.py

* Update download.py
上级 a103bacd
......@@ -143,7 +143,7 @@ if __name__ == '__main__':
pwd = os.path.join(os.path.dirname(__file__), './')
download_dataset(pwd)
elif sys.argv[1] == "model":
pwd = os.path.join(os.path.dirname(__file__), './pretrain_models')
pwd = os.path.join(os.path.dirname(__file__), './model_files')
download_model(pwd)
else:
usage()
......@@ -397,12 +397,12 @@ def test(conf_dict, args):
output = test_exe.run(program=test_prog,fetch_list=fetch_list)
if args.task_mode == "pairwise":
pred_list += list(map(lambda item: float(item[0]), output[0]))
predictions_file.write("\n".join(
map(lambda item: str((item[0] + 1) / 2).decode(), output[0])) + "\n")
predictions_file.write(u"\n".join(
map(lambda item: str((item[0] + 1) / 2), output[0])) + "\n")
else:
pred_list += map(lambda item: item, output[0])
predictions_file.write("\n".join(
map(lambda item: str(np.argmax(item)).decode(), output[0])) + "\n")
predictions_file.write(u"\n".join(
map(lambda item: str(np.argmax(item)), output[0])) + "\n")
except fluid.core.EOFException:
test_pyreader.reset()
break
......@@ -490,9 +490,9 @@ def infer(conf_dict, args):
output = test_exe.run(program=test_prog,fetch_list=fetch_list)
if args.task_mode == "pairwise":
preds_list += list(
map(lambda item: str((item[0] + 1) / 2).decode(), output[0]))
map(lambda item: str((item[0] + 1) / 2), output[0]))
else:
preds_list += map(lambda item: str(np.argmax(item)).decode(), output[0])
preds_list += map(lambda item: str(np.argmax(item)), output[0])
except fluid.core.EOFException:
infer_pyreader.reset()
break
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册