src/transformers/models/roc_bert/tokenization_roc_bert.py/RoCBertTokenizer/save_vocabulary
class RoCBertTokenizer:    def save_vocabulary(self, save_directory: str, filename_prefix: Optional[str] = None) -> Tuple[str, str, str]:
        index = 0
        if os.path.isdir(save_directory):
            vocab_file = os.path.join(
                save_directory,
                (filename_prefix + "-" if filename_prefix else "") + self.vocab_files_names["vocab_file"],
            )
            word_shape_file = os.path.join(
                save_directory,
                (filename_prefix + "-" if filename_prefix else "") + self.vocab_files_names["word_shape_file"],
            )
            word_pronunciation_file = os.path.join(
                save_directory,
                (filename_prefix + "-" if filename_prefix else "") + self.vocab_files_names["word_pronunciation_file"],
            )
        else:
            raise ValueError(
                f"Can't find a directory at path '{save_directory}'. To load the vocabulary from a Google "
                "pretrained model use `tokenizer = RoCBertTokenizer.from_pretrained(PRETRAINED_MODEL_NAME)`"
            )

        with open(vocab_file, "w", encoding="utf-8") as writer:
            for token, token_index in sorted(self.vocab.items(), key=lambda kv: kv[1]):
                if index != token_index:
                    logger.warning(
                        f"Saving vocabulary to {vocab_file}: vocabulary indices are not consecutive."
                        " Please check that the vocabulary is not corrupted!"
                    )
                    index = token_index
                writer.write(token + "\n")
                index += 1

        with open(word_shape_file, "w", encoding="utf8") as writer:
            json.dump(self.word_shape, writer, ensure_ascii=False, indent=4, separators=(", ", ": "))

        with open(word_pronunciation_file, "w", encoding="utf8") as writer:
            json.dump(self.word_pronunciation, writer, ensure_ascii=False, indent=4, separators=(", ", ": "))

        return (
            vocab_file,
            word_shape_file,
            word_pronunciation_file,
        )