Paddle icon indicating copy to clipboard operation
Paddle copied to clipboard

Throw the `Aborted at 1542866570 (unix time) try "date -d @1542866570" ` while executing sequence_softmax

Open linan142857 opened this issue 8 years ago • 3 comments

error

*** Aborted at 1542866570 (unix time) try "date -d @1542866570" if you are using GNU date *** PC: @ 0x0 (unknown) *** SIGSEGV (@0xfffffffffffffff0) received by PID 19008 (TID 0x7f2b1dcf2740) from PID 18446744073709551600; stack trace: *** @ 0x7f2b1d4ed130 (unknown) @ 0x7f2adba24e87 paddle::operators::SequenceSoftmaxKernel<>::Compute() @ 0x7f2adba25923 ZNSt17_Function_handlerIFvRKN6paddle9framework16ExecutionContextEEZNKS1_24OpKernelRegistrarFunctorINS0_8platform9CUDAPlaceELb0ELm0EJNS0_9operators21SequenceSoftmaxKernelINS7_17CUDADeviceContextEfEENSA_ISB_dEEEEclEPKcSG_EUlS4_E_E9_M_invokeERKSt9_Any_dataS4 @ 0x7f2adbc419f8 paddle::framework::OperatorWithKernel::RunImpl() @ 0x7f2adbc3e28f paddle::framework::OperatorBase::Run() @ 0x7f2ada7ab2db paddle::framework::Executor::RunPreparedContext() @ 0x7f2adaa46b7f paddle::operators::WhileOp::RunImpl() @ 0x7f2adbc3e28f paddle::framework::OperatorBase::Run() @ 0x7f2ada7ab2db paddle::framework::Executor::RunPreparedContext() @ 0x7f2ada7abf30 paddle::framework::Executor::Run() @ 0x7f2ada6c0f3d ZZN8pybind1112cpp_function10initializeIZN6paddle6pybindL13pybind11_initEvEUlRNS2_9framework8ExecutorERKNS4_11ProgramDescEPNS4_5ScopeEibbE64_vIS6_S9_SB_ibbEINS_4nameENS_9is_methodENS_7siblingEEEEvOT_PFT0_DpT1_EDpRKT2_ENUlRNS_6detail13function_callEE1_4_FUNEST @ 0x7f2ada6f3894 pybind11::cpp_function::dispatcher() @ 0x7f2b1d7dbfc7 PyEval_EvalFrameEx @ 0x7f2b1d7de4e9 PyEval_EvalCodeEx @ 0x7f2b1d7db9b8 PyEval_EvalFrameEx @ 0x7f2b1d7de4e9 PyEval_EvalCodeEx @ 0x7f2b1d7db9b8 PyEval_EvalFrameEx @ 0x7f2b1d7de4e9 PyEval_EvalCodeEx @ 0x7f2b1d7db9b8 PyEval_EvalFrameEx @ 0x7f2b1d7de4e9 PyEval_EvalCodeEx @ 0x7f2b1d7db9b8 PyEval_EvalFrameEx @ 0x7f2b1d7de4e9 PyEval_EvalCodeEx @ 0x7f2b1d7de70a PyEval_EvalCode @ 0x7f2b1d7f79cd run_mod @ 0x7f2b1d7f8b48 PyRun_FileExFlags @ 0x7f2b1d7f9d68 PyRun_SimpleFileExFlags @ 0x7f2b1d80bf8c Py_Main @ 0x7f2b1ca35b45 __libc_start_main @ 0x7f2b1dcfb8bf (unknown)

code-fragment `

def decoder_ctc_with_attention(cls_embedding, encoder_proj, decoder_boot, time_steps, decoder_size, num_classes, batch_size=64):

  para_attr = fluid.ParamAttr(
        regularizer=regularizer,
        gradient_clip=gradient_clip,
        initializer=fluid.initializer.Normal(0.0, 0.02))
  bias_attr = fluid.ParamAttr(
        regularizer=regularizer,
        gradient_clip=gradient_clip,
        initializer=fluid.initializer.Normal(0.0, 0.0))

  def simple_attention(encoder_proj, decoder_state):
    encoder_state_proj = fluid.layers.fc(input=encoder_proj,
            size=decoder_size,
            param_attr=para_attr,
            bias_attr=bias_attr)
    decoder_state_proj = fluid.layers.fc(input=decoder_state,
            size=decoder_size,
            param_attr=para_attr,
            bias_attr=bias_attr)
    decoder_state_expand = fluid.layers.sequence_expand(
            x=decoder_state_proj, y=encoder_proj)
    concated = fluid.layers.tanh(x=decoder_state_expand + encoder_state_proj)
    attention_weights = fluid.layers.fc(
            input=concated,
            size=1,
            act=None,
            bias_attr=False)
  ==> attention_weights = fluid.layers.sequence_softmax(input=attention_weights)
    weigths_reshape = fluid.layers.reshape(x=attention_weights, shape=[-1])
    scaled = fluid.layers.elementwise_mul(
        x=encoder_proj, y=weigths_reshape, axis=0)
    context = fluid.layers.sequence_pool(input=scaled, pool_type='sum')
    return context

array_len = fluid.layers.fill_constant(shape=[1], dtype='int64', value=time_steps-2)
counter = fluid.layers.zeros(shape=[1], dtype='int64', force_cpu=True)
output_array = fluid.layers.create_array('float32')
hidden_array = fluid.layers.create_array('float32')
fluid.layers.array_write(decoder_boot, array=hidden_array, i=counter)

length = fluid.layers.ones(shape=[batch_size, 1], dtype='int64') * 3
offset = fluid.layers.zeros(shape=[batch_size, 1], dtype='int64')
increase = fluid.layers.ones(shape=[batch_size, 1], dtype='int64')

cond = fluid.layers.less_than(x=counter, y=array_len)
while_op = fluid.layers.While(cond=cond)
with while_op.block():
    filtered_signal = fluid.layers.sequence_slice(encoder_proj, offset, length)
    pre_state = fluid.layers.array_read(array=hidden_array, i=counter)
    context = simple_attention(filtered_signal, pre_state)
    current_state = fluid.layers.fc(input=context, size=decoder_size, bias_attr=True)
    out = fluid.layers.fc(input=current_state, size=num_classes + 1, bias_attr=True, act='softmax')
    fluid.layers.array_write(out, array=output_array, i=counter)
    fluid.layers.increment(x=counter, value=1, in_place=True)
    fluid.layers.array_write(current_state, array=hidden_array, i=counter)
    offset = offset + increase
    #fluid.layers.increment(x=offset, value=1, in_place=True)
return output_array

`

maybe my wrong use of the sequence_slice?

linan142857 avatar Nov 22 '18 06:11 linan142857

The usage of sequence_slice seems fine. Maybe the error results from reading empty data in while loop, please have a try to check the boundary condition.

kuke avatar Nov 22 '18 06:11 kuke

The usage of sequence_slice seems fine. Maybe the error results from reading empty data in while loop, please have a try to check the boundary condition.

The batch_size is set to 2 and the slice-length is set as 3. fluid.layers.Print(attention_weights) attention_weights = fluid.layers.sequence_softmax(input=attention_weights)

The attention_weights is printed, which seems fine.

============================= % (self.class.name, self.class.name), Warning) 1542871432 Tensor[fc_6.tmp_0] shape: [6,1,] dtype: f data: -0.102977,-0.0671334,-0.0560927,-0.0812161,-0.0756071,-0.0652401, *** Aborted at 1542871432 (unix time) try "date -d @1542871432" if you are using GNU date *** PC: @ 0x0 (unknown) *** SIGSEGV (@0xfffffffffffffff0) received by PID 127597 (TID 0x7f84347bb740) from PID 18446744073709551600; stack trace: *** @ 0x7f8433fb6130 (unknown) @ 0x7f83f24ede87 paddle::operators::SequenceSoftmaxKernel<>::Compute() @ 0x7f83f24ee923

linan142857 avatar Nov 22 '18 07:11 linan142857

The core is located. the LoDtensor will lost its lod after passing fc-layer. I remove the fc and it runs ok.

linan142857 avatar Nov 22 '18 10:11 linan142857