import json
from transformers.tokenization_utils_fast import PreTrainedTokenizerFast
class MiniCPMVTokenizerFast(PreTrainedTokenizerFast):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.eot_token = "<|eot_id|>"
self.im_start = ""
self.im_end = ""
self.ref_start = "["
self.ref_end = "]"
self.box_start = ""
self.box_end = ""
self.quad_start = ""
self.quad_end = ""
self.slice_start = ""
self.slice_end = ""
@property
def eos_id(self):
return self.eos_token_id
@property
def bos_id(self):
return self.bos_token_id
@property
def unk_id(self):
return self.unk_token_id
@property
def eot_id(self):
return self.convert_tokens_to_ids(self.eot_token)
@property
def im_start_id(self):
return self.convert_tokens_to_ids(self.im_start)
@property
def im_end_id(self):
return self.convert_tokens_to_ids(self.im_end)
@staticmethod
def escape(text: str) -> str:
return text
@staticmethod
def unescape(text: str) -> str:
return text