Learning to Generalize across Long-Horizon Tasks from Human Demonstrations