How to define modal size?

I want to design a modal-dialog, which contains a stepper. Also in some cases, the input fields are not too many and in other cases, they are A LOT of them.

Which means if I predefine the size of the modal, in some sections of the stepper it must expand on the width or I will keep huge empty space in order to predict the edge case.

What can I do?