Generic function for counting the number of models used for fitting the object.
Returns the number of models used for fitting.
However, note that the objects returned by msgl.cv and
msgl.subsampling does not contain any models even though
nmod returns a nonzero number.