ValueError: setting an array element with a sequence -- Text classification

Hi everyone,

I’m trying to format the data to fit in Keras but since my arrays are of different lengh using a Fully Convolutional Network into 3 classes
Since my input are of different shape, I need to find a way to feed the network. I tried different things but none works. On my simplest attempt, I got a “ValueError: setting an array element with a sequence”

Any ideas ?
Thanks

Here is my model:

ip = Input(shape=(None,))
x = Embedding(len(vocabulary_inv), embedding_dim)(ip)
x = BatchNormalization()(x)
x = Conv1D(filters,kernel_size,padding='valid',activation='relu')(x)
x = BatchNormalization()(x)
x = Conv1D(filters,kernel_size,padding='valid',activation='relu')(x)
x = BatchNormalization()(x)
x = Conv1D(filters,kernel_size,padding='valid',activation='relu')(x)
x = BatchNormalization()(x)
x = Conv1D(filters,kernel_size,padding='valid',activation='relu')(x)
x = BatchNormalization()(x)
x = Conv1D(3,3,padding='valid',activation='softmax')(x)
x = GlobalAveragePooling1D()(x)
output = Activation('softmax')(x)

conv_model = Model(ip,output)
conv_model.compile(loss=['categorical_crossentropy'],
          optimizer='adam',
          metrics=['accuracy'])
conv_model.fit(train, target,
      batch_size=batch_size,
      epochs=epochs)

My data looks like this:

[38, 43, 67, 43, 46, 67, 42, 40, 35, 40, 43, 4... -> Shape = (1716,)
[38, 43, 67, 43, 46, 67, 42, 40, 35, 40, 43, 4... -> Shape = (81,)
[89, 43, 42, 87, 67, 54, 52, 46, 42, 35, 8, 68...
[89, 38, 49, 43, 46, 67, 42, 67, 38, 54, 52, 4...
[89, 54, 52, 46, 71, 42, 40, 46, 71, 35, 71, 5...