> Concerning generate, although the code is a bit bloated, it is quite simple, the call is within the sampling while loop here: https://github.com/huggingface/transformers/blob/6c1d0b069de22d7ed8aa83f733c25045eea0585d/src/transformers/generation/utils.py#L2650-L2656