未验证 提交 cf79c0af 编写于 作者: L linjieccc 提交者: GitHub

Fix errors in windows (#1653)

上级 41bee5c9
......@@ -195,7 +195,7 @@
headers = {"Content-Type": "application/json"}
for t in text:
print("input: {}".format(t))
r = requests.post(url=url, headers=headers, data=json.dumps(t))
result = requests.post(url=url, headers=headers, data=json.dumps(t))
# 打印预测结果
print("model output: {}\n".format(result))
......
......@@ -29,6 +29,8 @@ class STACLTokenizer:
special_token=["<s>", "<e>", "<unk>"]):
bpe_parser = subword_nmt.create_apply_bpe_parser()
bpe_args = bpe_parser.parse_args(args=['-c', bpe_codes_fpath])
bpe_args.codes.close()
bpe_args.codes = open(bpe_codes_fpath, 'r', encoding='utf-8')
self.bpe = subword_nmt.BPE(bpe_args.codes, bpe_args.merges,
bpe_args.separator, None,
bpe_args.glossaries)
......
......@@ -195,7 +195,7 @@
headers = {"Content-Type": "application/json"}
for t in text:
print("input: {}".format(t))
r = requests.post(url=url, headers=headers, data=json.dumps(t))
result = requests.post(url=url, headers=headers, data=json.dumps(t))
# 打印预测结果
print("model output: {}\n".format(result))
......
......@@ -29,6 +29,8 @@ class STACLTokenizer:
special_token=["<s>", "<e>", "<unk>"]):
bpe_parser = subword_nmt.create_apply_bpe_parser()
bpe_args = bpe_parser.parse_args(args=['-c', bpe_codes_fpath])
bpe_args.codes.close()
bpe_args.codes = open(bpe_codes_fpath, 'r', encoding='utf-8')
self.bpe = subword_nmt.BPE(bpe_args.codes, bpe_args.merges,
bpe_args.separator, None,
bpe_args.glossaries)
......
......@@ -29,6 +29,8 @@ class STACLTokenizer:
special_token=["<s>", "<e>", "<unk>"]):
bpe_parser = subword_nmt.create_apply_bpe_parser()
bpe_args = bpe_parser.parse_args(args=['-c', bpe_codes_fpath])
bpe_args.codes.close()
bpe_args.codes = open(bpe_codes_fpath, 'r', encoding='utf-8')
self.bpe = subword_nmt.BPE(bpe_args.codes, bpe_args.merges,
bpe_args.separator, None,
bpe_args.glossaries)
......
......@@ -29,6 +29,8 @@ class STACLTokenizer:
special_token=["<s>", "<e>", "<unk>"]):
bpe_parser = subword_nmt.create_apply_bpe_parser()
bpe_args = bpe_parser.parse_args(args=['-c', bpe_codes_fpath])
bpe_args.codes.close()
bpe_args.codes = open(bpe_codes_fpath, 'r', encoding='utf-8')
self.bpe = subword_nmt.BPE(bpe_args.codes, bpe_args.merges,
bpe_args.separator, None,
bpe_args.glossaries)
......
......@@ -29,6 +29,8 @@ class STACLTokenizer:
special_token=["<s>", "<e>", "<unk>"]):
bpe_parser = subword_nmt.create_apply_bpe_parser()
bpe_args = bpe_parser.parse_args(args=['-c', bpe_codes_fpath])
bpe_args.codes.close()
bpe_args.codes = open(bpe_codes_fpath, 'r', encoding='utf-8')
self.bpe = subword_nmt.BPE(bpe_args.codes, bpe_args.merges,
bpe_args.separator, None,
bpe_args.glossaries)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册