  We study the evolution of atomic and molecular gas in galaxies in
semi-analytic models of galaxy formation that include new modeling of the
partitioning of cold gas in galactic discs into atomic, molecular, and ionised
phases. We adopt two scenarios for the formation of molecules: one
pressure-based and one metallicity-based. We find that both recipes
successfully reproduce the gas fractions and gas-to-stellar mass ratios of HI
and H2 in local galaxies,as well as the HI and H2 disc sizes up to z<2. We
reach good agreement with the locally observed HI and H2 mass function,
although both recipes slightly overpredict the low-mass end of the HI mass
function. Both of our models predict that the high-mass end of the HI mass
function remains nearly constant at redshifts z < 2.0. The metallicity-based
recipe yields a higher cosmic density of cold gas and much lower cosmic H2
fraction over the entire redshift range probed than the pressure based recipe.
These strong differences in HI mass function and cosmic density between the two
recipes are driven by low mass galaxies (log (M*/Msun) < 7) residing in low
mass halos (log (Mvir/Msun) < 10). Both recipes predict that galaxy gas
fractions remain high from z ~ 6-3 and drop rapidly at lower redshift. The
galaxy H2 fractions show a similar trend, but drop even more rapidly. We
provide predictions for the CO J = 1-0 luminosity of galaxies, which will be
directly comparable with observations with sub-mm and radio instruments.
