DFGM model with generic polytropic transformation and a varying exponent