Compositional visual generation with energy-based modeling