towhee.models.clip4clip.utils.convert_tokens_to_id¶
- towhee.models.clip4clip.utils.convert_tokens_to_id(tokenizer: SimpleTokenizer, words: str, max_words: int = 32) ndarray [source]¶
Convert tokens to token ID. :param tokenizer: SimpleTokenizer instance. :type tokenizer: SimpleTokenizer :param words: Raw text words. :type words: str :param max_words: Max mord length, if not enough, the output ID is 0. :type max_words: int
- Returns:
Ndarray of ID list.