未验证 提交 5069baf0 编写于 作者: L littletomatodonkey 提交者: GitHub

Merge pull request #622 from BeyondYourself/BeyondYourself-barnch-8-27

fix the file read
......@@ -599,7 +599,7 @@ class SASTProcessTrain(object):
"""
text_polys, txt_tags, txts = [], [], []
with open(poly_txt_path) as f:
with open(poly_txt_path, 'rb') as f:
for line in f.readlines():
poly_str, txt = line.strip().split('\t')
poly = map(float, poly_str.split(','))
......
......@@ -90,3 +90,15 @@ def check_and_read_gif(img_path):
return imgvalue, True
return None, False
def create_multi_devices_program(program, loss_var_name):
build_strategy = fluid.BuildStrategy()
build_strategy.memory_optimize = False
build_strategy.enable_inplace = True
exec_strategy = fluid.ExecutionStrategy()
exec_strategy.num_iteration_per_drop_scope = 1
compile_program = fluid.CompiledProgram(program).with_data_parallel(
loss_name=loss_var_name,
build_strategy=build_strategy,
exec_strategy=exec_strategy)
return compile_program
......@@ -90,13 +90,13 @@ def load_config(file_path):
merge_config(default_config)
_, ext = os.path.splitext(file_path)
assert ext in ['.yml', '.yaml'], "only support yaml files for now"
merge_config(yaml.load(open(file_path), Loader=yaml.Loader))
merge_config(yaml.load(open(file_path, 'rb'), Loader=yaml.Loader))
assert "reader_yml" in global_config['Global'],\
"absence reader_yml in global"
reader_file_path = global_config['Global']['reader_yml']
_, ext = os.path.splitext(reader_file_path)
assert ext in ['.yml', '.yaml'], "only support yaml files for reader"
merge_config(yaml.load(open(reader_file_path), Loader=yaml.Loader))
merge_config(yaml.load(open(reader_file_path, 'rb'), Loader=yaml.Loader))
return global_config
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册