You can create dummy inputs
# you have defined the rest of your graph somewhere here
Y_train = Input(shape=...)
X_train_length = Input(shape=...)
loss = Lambda(function=ctc_lambda_func, name='ctc', output_shape=(1,)
)([y_pred, Y_train, X_train_length, label_length])
# defining the model is slightly different with multiple inputs
training_model = Model(inputs=[image_input, Y_train, X_train_length], outputs=[loss])
And when you want to train your model you will pass the parameter x as a list of length 3, such as
x = [<images - np.ndarray shape (batch, h, w, c)>, <Y_train inputs - np.ndarray>,
<X_train_length inputs - np.ndarray>]
And of course dummy values for y
y = np.zeros((batch, 1))
And it's never been simpler finally than training_model.train_on_batch(x, y)
Alternatively make a generator that generates x and y in the form described above and use training_model.fit_generator(data_generator)