Variational excess risk bound for general state space models