Inversion codes allow the reconstruction of a model atmosphere from observations. With the inclusion of optically thick lines that form in the solar chromosphere, such modeling is computationally very expensive because a non-LTE evaluation of the radiation field is required. In this study, we combine the results provided by these traditional methods with machine and deep learning techniques to obtain similar-quality results in an easy-to-use, much faster way. We have applied these new methods to Mg ii h and k lines observed by the Interface Region Imaging Spectrograph (IRIS). As a result, we are able to reconstruct the thermodynamic state (temperature, line-of-sight velocity, nonthermal velocities, electron density, etc.) in the chromosphere and upper photosphere of an area equivalent to an active region in a few CPU minutes, speeding up the process by a factor of 105 − 106. The open-source code accompanying this Letter will allow the community to use IRIS observations to open a new window to a host of solar phenomena.