提交 ada30bc3 编写于 作者: X xixiaoyao

fix bugs

上级 7b88fcf9
task_instance: "mrqa, match4mrqa"
target_tag: 1, 0
mix_ratio: 0.5, 0.5
task_instance: "mrqa, mlm4mrqa, match4mrqa"
target_tag: 1, 0, 0
mix_ratio: 0.5, 1.0, 0.5
save_path: "output_model/secondrun"
......@@ -12,7 +12,7 @@ do_lower_case: True
max_seq_len: 512
batch_size: 4
num_epochs: 0.5
num_epochs: 2
optimizer: "adam"
learning_rate: 3e-5
warmup_proportion: 0.1
......
......@@ -51,12 +51,13 @@ class TaskParadigm(task_paradigm):
return {"logits": [[-1], 'float32']}
def build(self, inputs):
mask_pos = inputs["reader"]["mask_pos"]
if self._is_training:
mask_label = inputs["reader"]["mask_label"]
# 多任务学习时才需要引入这个,防止其他run其他任务时导致seqlen过小,gather超范围
batchsize_x_seqlen = inputs["reader"]["batchsize_x_seqlen"]
max_position = inputs["reader"]["batchsize_x_seqlen"] - 1
mask_pos = fluid.layers.elementwise_min(mask_pos, max_position)
mask_pos = inputs["reader"]["mask_pos"]
word_emb = inputs["backbone"]["embedding_table"]
enc_out = inputs["backbone"]["encoder_outputs"]
......@@ -65,13 +66,6 @@ class TaskParadigm(task_paradigm):
_param_initializer = fluid.initializer.TruncatedNormal(
scale=self._initializer_range)
if self._is_training:
# 多任务训练时才需要引入这个,防止其他run其他任务时导致seqlen过小,gather超范围
# mask_pos = fluid.layers.cast(x=mask_pos, dtype='int32')
mask_pos = fluid.layers.elementwise_min(mask_pos, batchsize_x_seqlen)
#print(fluid.default_main_program().blocks[0].vars)
reshaped_emb_out = fluid.layers.reshape(
x=enc_out, shape=[-1, emb_size])
......
......@@ -77,9 +77,9 @@ class TaskParadigm(task_paradigm):
if self._is_training:
start_positions = inputs['reader']['start_positions']
end_positions = inputs['reader']['end_positions']
seqlen = inputs["reader"]["seqlen"]
start_positions = fluid.layers.elementwise_min(start_positions, seqlen)
end_positions = fluid.layers.elementwise_min(end_positions, seqlen)
max_position = inputs["reader"]["seqlen"] - 1
start_positions = fluid.layers.elementwise_min(start_positions, max_position)
end_positions = fluid.layers.elementwise_min(end_positions, max_position)
else:
unique_id = inputs['reader']['unique_ids']
......
export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
python -u demo2.py
while true
do
python -u demo2.py
done
# GLOG_vmodule=lookup_table_op=4 python -u demo2.py > debug2.log 2>&1
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册