Generative Modeling with Flow-Guided Density Ratio Learning