from transformers.models.qwen2 import Qwen2TokenizerFast
class MiniCPMVTokenizerFast(Qwen2TokenizerFast):
def __init__(self, **kwargs):
super().__init__(**kwargs)
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 = ""
self.im_id_start = ""
self.im_id_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 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)
@property
def slice_start_id(self):
return self.convert_tokens_to_ids(self.slice_start)
@property
def slice_end_id(self):
return self.convert_tokens_to_ids(self.slice_end)
@property
def im_id_start_id(self):
return self.convert_tokens_to_ids(self.im_id_start)
@property
def im_id_end_id(self):
return self.convert_tokens_to_ids(self.im_id_end)
@property
def newline_id(self):
return self.convert_tokens_to_ids("\n")
@staticmethod
def escape(text: str) -> str:
return text
@staticmethod
def unescape(text: str) -> str:
return text