stared / livelossplot

Live training loss plot in Jupyter Notebook for Keras, PyTorch and others
https://p.migdal.pl/livelossplot
MIT License
1.29k stars 143 forks source link

'PlotLossesCallback' object has no attribute 'on_train_batch_begin' #55

Closed Jiraiyah closed 5 years ago

Jiraiyah commented 5 years ago

Hi

Here is my Fitting section of neural network

`opt = tf.keras.optimizers.Adam(lr=0.001, decay = 1e-6) model.compile(loss='sparse_categorical_crossentropy', optimizer= opt, metrics= ['accuracy'] )

tensorboard = TensorBoard(log_dir=f"logs/{MODEL_NAME}-{int(time.time())}") filePath = MODEL_NAME + "-{epoch:04d}-{val_loss : .6f}"

checkpoint = ModelCheckpoint("Models/{}.model".format(filePath, monitor='val_loss', verbose = 1, save_best_only = True, mode='max'))

plot_losses = PlotLossesCallback()

history = model.fit(Train_X, Train_Y, batch_size=BATCH_SIZE, epochs=EPOCHS, validation_data=(Validation_X, Validation_Y), callbacks=[tensorboard, checkpoint, plot_losses])

M5Model.save(f'./Models/{SEQ_LEN}-SEQ--{BATCH_SIZE}-BatchSize-{CHART_TO_PREDICT}-MODEL-{MODEL_TYPE}.h5')`

why am i getting this error?

stared commented 5 years ago

@Jiraiyah Please:

Jiraiyah commented 5 years ago

@Jiraiyah Please:

  • copy error message,
  • use formatting (not plaintext) for code.

the error message was actually a copy / paste. (title)

for the coding, i tried to use < code > (ignore spaces) but for some odd reason, copy pasting the code from jupyter causes issues, not sure how people were sending those code snippets from jupyter into git issues. sorry for that, if you can tell me, i will use it from now on

stared commented 5 years ago

@Jiraiyah

The code looks like that (look at the source):

history = model.fit(Train_X, Train_Y,
batch_size=BATCH_SIZE,
epochs=EPOCHS,
validation_data=(Validation_X, Validation_Y),
callbacks=[tensorboard, checkpoint, plot_losses])

Still, don't see any ERROR message (like, containing words Error or Exception).