Learning to simulate and predict chaotic dynamical systems