I create my own class which create a Keras model inside one of its methods.
self.model = Sequential()
self.model.add(LSTM(32))
self.model.add(Dense(2, activation='relu'))
self.model.compile(optimizer='RMSprop', loss='categorical_crossentropy', metrics=['acc'])
In other method i try to train this model using python generator as data provider.
self.model.fit_generator(my_gen(), steps=10, epochs=1, verbose=1)
This causes an error:
raise RuntimeError('You must compile your model before using it.')
RuntimeError: You must compile your model before using it.
Error does not rises if i change LSTM layer to Dense layer. What am i doing wrong?
Keras version 2.2.0 with Tensorflow 1.8.0 backend.