I've built my own Keras model class inheriting from keras.Model. However, I have a modified training step, where I manually derive the forward pass and compute two different losses which I sum up such that my total loss is total_loss = loss1 + factor*loss2. I observed that I get better results if I decrease the factor during training. My question would be now, what a good solution for this might be. Can I either access somehow the epoch number in the train_step method such that I can compute the factor from the epoch number or is there any other preferable approach?
thanks a lot :)
EDIT: If I add a counter to the train_step method, it won't increase during training. But this only happens in non-eager mode. If I enable eager mode it works. Any idea on how I could make it work in non-eager mode?
