transformers 5.x removed GenerationMixin._get_initial_cache_position in favour of new cache helpers. MOSS-TTS' custom _sample method still calls self._get_initial_cache_position(cur_len, device, model_kwargs) so we have to restore it. The reimplementation matches the old behaviour: populate model_kwargs['cache_position'] with arange(past_length, cur_len).