feat: tagIdConverter size property
This commit is contained in:
parent
28ddd289b7
commit
30cb6b8fe0
@ -103,7 +103,13 @@ class TagIdConverter:
|
|||||||
@property
|
@property
|
||||||
def pad_id(self):
|
def pad_id(self):
|
||||||
return self.vocab["[PAD]"]
|
return self.vocab["[PAD]"]
|
||||||
|
@property
|
||||||
|
def size(self):
|
||||||
|
return len(self.vocab)
|
||||||
|
|
||||||
|
def __len__(self):
|
||||||
|
return self.size
|
||||||
|
|
||||||
def convert_ids_to_tokens(self,ids: List[int]):
|
def convert_ids_to_tokens(self,ids: List[int]):
|
||||||
return [self.ids_to_token[id] for id in ids]
|
return [self.ids_to_token[id] for id in ids]
|
||||||
def convert_tokens_to_ids(self, tokens: List[str]):
|
def convert_tokens_to_ids(self, tokens: List[str]):
|
||||||
|
Loading…
Reference in New Issue
Block a user