src/transformers/models/pegasus/tokenization_pegasus.py/PegasusTokenizer/_special_token_mask
class PegasusTokenizer:    def _special_token_mask(self, seq):
        all_special_ids = set(self.all_special_ids)  # call it once instead of inside list comp
        all_special_ids.remove(self.unk_token_id)  # <unk> is only sometimes special

        return [1 if x in all_special_ids else 0 for x in seq]