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

Remove unk token #212

Closed
wants to merge 2 commits into from
Closed
Changes from all 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
5 changes: 3 additions & 2 deletions maze_transformer/tokenizer.py
Original file line number Diff line number Diff line change
@@ -81,8 +81,9 @@ def __init__(

# We are having to do evil things here
vocab: dict[str, int] = {token: i for i, token in enumerate(token_arr)}
vocab[self.unk_token] = len(vocab)
self.vocab: dict[str, int] = vocab
if self.unk_token not in vocab: # maze-dataset >=X.X.X includes <UNK> already
vocab[self.unk_token] = len(vocab)
self.vocab: dict[str, int] = vocab

special_tokens = list(SPECIAL_TOKENS.values())
normal_tokens = [x for x in token_arr if x not in special_tokens]
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -10,11 +10,11 @@ repository = "https://github.com/understanding-search/maze-transformer"
[tool.poetry.dependencies]
python = ">=3.10,<3.13"
# dataset
maze-dataset = "^0.4.5"
maze-dataset = "^1.0.0"
# transformers
torch = ">=1.13.1"
torch = "^1.13.1"
transformer-lens = "1.14.0"
transformers = ">=4.34" # Dependency in transformer-lens 1.14.0
transformers = "^4.34" # Dependency in transformer-lens 1.14.0
# utils
muutils = "^0.5.5"
zanj = "^0.2.0"