'Sequential' object has no attribute 'fit_generator'

37 Views Asked by At

I have following code

from keras_preprocessing.sequence import TimeseriesGenerator
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import LSTM

n_input = 12
n_features = 1

train_generator = TimeseriesGenerator(data = scaled_train, targets = scaled_train, length = n_input, batch_size = 1) 

model = Sequential()

model.add(LSTM(150, activation = 'relu', input_shape = (n_input, n_features)))
model.add(Dense(1))
model.compile(optimizer = 'adam', loss = 'mse')


I was trying to run

model.fit_generator(train_generator, epochs = 25)

But I'm getting the error

AttributeError                            Traceback (most recent call last)
Cell In [35], line 1
----> 1 model.fit_generator(train_generator, epochs = 25)

AttributeError: 'Sequential' object has no attribute 'fit_generator'

I've tried to reinstall keras, tensorflow, and other libraries, restart computer but nothing works. Could you advise what should I do? Thanks!

0

There are 0 best solutions below