src/transformers/generation/configuration_utils.py/GenerationConfig/validate
class GenerationConfig:    def validate(self):
        """
        Validates the values of the attributes of the GenerationConfig instance, and raises a `ValueError` if any of
        the values are invalid.
        """
        if self.early_stopping not in {True, False, "never"}:
            raise ValueError(f"`early_stopping` must be a boolean or 'never', but is {self.early_stopping}.")