Tobitor
Tobitor

Reputation: 1508

Training neural network in Google Colab CPU - second epoch does not start

I am training a neural network on Google Colab CPU (I cannot use a GPU regarding another issue: FileNotFoundError: No such file: -> Error occuring only on GPU, not on CPU) with the fit_generator method.

model.fit_generator(generator=training_generator,
                    validation_data=validation_generator,
                    steps_per_epoch = num_train_samples // 128,
                    validation_steps = num_val_samples // 128,
                    epochs = 10,
                    use_multiprocessing=True,
                    workers=6)

The training for the first epoch seems to run fine, but the second does not start. The notebook does not break down or the iteration does not stop. However, the second epoch is not starting...

Is there something wrong with my code?

Upvotes: 0

Views: 2411

Answers (1)

Vijeth Rai
Vijeth Rai

Reputation: 320

Heyy

The epoch is very slow because it seems to be calculating validation loss and stuff.This is a common thing. You can only see training progress but not validation progress unless you build a custom callback regarding that.

The issue with your fit_generator is that you dont seem to have understood how to use steps_per_epoch and validation_steps. Unless your validation and train data have same size(number of images) they cant have same number of steps(I mean they "can" but you know what I mean)

I really recommend you use GPU for such data, since it is taking too long on CPU. Try debugging your code because GPU is so worth it.

Upvotes: 2

Related Questions