tatsath / fin-ml

This github repository of "Machine Learning and Data Science Blueprints for Finance". Please star.
901 stars 416 forks source link

Chapter 9 - Trading strategy - kernel Died #15

Open alecontuIT opened 7 months ago

alecontuIT commented 7 months ago

During the training of the model i can't even finish the first episode because after some time I get the message "Kernel died". I'm using a macbook with m1. I tried to lower the training size, the memory size, but the result is always the same.

vkresch commented 2 months ago

You need to clear the session when training multiple models in a loop because Keras is managing a global state which consume more memory the more loops the model training takes. Import with keras import backend as K and put K.clear_session() at the end of the for loop.

Source: https://keras.io/api/utils/config_utils/