Phase transitions in restricted Boltzmann machines with generic priors