Advances in Amortized Bayesian Inference, with Applications to Astronomy