Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add more special tokens #71

Merged
merged 7 commits into from
Dec 28, 2023
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ai21_tokenizer/jurassic_tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def __init__(
self.unk_id = config.get("unk_id")
self.eop_id = config.get("eop_id")
self.bos_id = config.get("bos_id")
self.eos_id = config.get("eos_id")

self._newline_piece = config.get("newline_piece")
self._mask_pieces = config.get("mask_pieces", [])
Expand All @@ -42,7 +43,7 @@ def __init__(
self._convert_ids_to_tokens([i for i in range(self.vocab_size) if self._sp.IsControl(i)])
)

self._newline_id = self._token_to_id(self._newline_piece)
self.newline_id = self._token_to_id(self._newline_piece)

self._sample_split = re.compile(r"▁*[^▁]+|▁")
self._space_split = re.compile("( {2,})") # Split by 2 or more consecutive spaces
Expand Down
Loading