Fiz o teste e corrigi o código:
if len(trader.memory) > batch_size: try: trader.batch_train(batch_size) except: pass
Experimente fazer esta correção no Loop do treinamento:
if len(trader.memory) > batch_size:
try:
trader.batch_train(batch_size)
except:
pass
acredito que vai funcionar