Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
c99c130
fix EVERYTHING
ArthurZucker Aug 1, 2023
acf31e2
more fixes
ArthurZucker Aug 1, 2023
7305aff
⚗️⚗️ Tokenizer magic ⚗️⚗️
ArthurZucker Aug 1, 2023
01b8347
wrong value but test passes for the TODO
ArthurZucker Aug 1, 2023
b9ddbbb
update
ArthurZucker Aug 1, 2023
83af718
updat
ArthurZucker Aug 1, 2023
0babe38
safe protobuf import?
ArthurZucker Aug 1, 2023
0fdf51e
style
ArthurZucker Aug 1, 2023
2d197a1
non gated repo
ArthurZucker Aug 1, 2023
e9c7a72
update
ArthurZucker Aug 1, 2023
94964cd
fixup
ArthurZucker Aug 1, 2023
cc9ddcf
Merge branch 'main' of https://github.com/huggingface/transformers in…
ArthurZucker Aug 1, 2023
45cae43
Update src/transformers/models/llama/tokenization_llama.py
ArthurZucker Aug 2, 2023
53557a9
Update src/transformers/models/llama/tokenization_llama.py
ArthurZucker Aug 2, 2023
e049d11
Update tests/models/t5/test_tokenization_t5.py
ArthurZucker Aug 2, 2023
b64b2d2
nits
ArthurZucker Aug 2, 2023
cb95361
fix t5 too
ArthurZucker Aug 2, 2023
a86bf78
use assert equal
ArthurZucker Aug 2, 2023
913cd1d
fix llama decoding
ArthurZucker Aug 2, 2023
ef28574
nits on t5
ArthurZucker Aug 2, 2023
4f65261
fixup
ArthurZucker Aug 2, 2023
ad7f8c6
only remove the prefix space, not other spaces
ArthurZucker Aug 2, 2023
76d00cc
more deconding tests and more todos
ArthurZucker Aug 2, 2023
9cb92b6
fix CI as well
ArthurZucker Aug 2, 2023
204153f
fixup
ArthurZucker Aug 2, 2023
9f37103
skip failing test on CI (its tf its ok)
ArthurZucker Aug 2, 2023
700ee64
Merge branch 'main' of https://github.com/huggingface/transformers in…
ArthurZucker Aug 3, 2023
4b5315b
skip test_subword_regularization_tokenizer that is also crashing on t…
ArthurZucker Aug 3, 2023
a4ed16f
Merge branch 'main' of https://github.com/huggingface/transformers in…
ArthurZucker Aug 16, 2023
e7906c2
update llama
ArthurZucker Aug 17, 2023
ad33c97
revert good fixes
ArthurZucker Aug 17, 2023
f890882
fixup
ArthurZucker Aug 17, 2023
b7f98bc
empty
ArthurZucker Aug 17, 2023
bb79083
explain why we need to encode with an additional token
ArthurZucker Aug 17, 2023
3f8ac96
better warning?
ArthurZucker Aug 17, 2023
4249986
nits
ArthurZucker Aug 17, 2023
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
Prev Previous commit
Next Next commit
updat
  • Loading branch information
ArthurZucker committed Aug 1, 2023
commit 83af7184e3b4b234650a2c0e5a5b28b4475a4dd9
1 change: 1 addition & 0 deletions src/transformers/models/llama/tokenization_llama.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ def tokenize(self, text, **kwargs) -> List[str]:
# Replace the SPIECE_UNDERLINE with a space to make sure SPIECE_UNDERLINE is only used at
# the beginning of the text
if not self.legacy:
# replacing " " by SPIECE_UNDERLINE prevents any form of stripping...
text = SPIECE_UNDERLINE + text.replace(SPIECE_UNDERLINE, " ")
return super().tokenize(text, **kwargs)

Expand Down
8 changes: 5 additions & 3 deletions tests/models/t5/test_tokenization_t5.py
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous test values were not really good, with this update it makes more sense

Original file line number Diff line number Diff line change
Expand Up @@ -448,9 +448,11 @@ def test_remove_extra_whitespaces(self):
input_ids = self.tokenizer.encode("▁He is not<extra_id_0> ▁He")
# TODO another example of lstrip
self.assertEqual(input_ids, [156, 46, 44, 1000, 262, 15, 2])

tokens = self.tokenizer.tokenize("▁He is not<extra_id_0> ▁He")
self.assertEqual(tokens, ['▁He', '▁is', '▁not', '<extra_id_0>', 'H', 'e']) # spaces are eaten by spm + our strip
self.assertEqual(
tokens, ["▁He", "▁is", "▁not", "<extra_id_0>", "H", "e"]
) # spaces are eaten by spm + our strip
# make sure that the output after the extra id is the same as if
# extra_id was not there
input_ids = self.tokenizer.encode("▁He is not ▁He")
Expand Down Expand Up @@ -483,7 +485,7 @@ def test_special_tokens_strip(self):
self.assertEqual(input_ids, [284, 1000, 262, 15, 2])
# spaces are eaten by rstrip / lstrip, so this is expected. Don't strip otherwise you break
tokens = self.tokenizer.tokenize("No <extra_id_0> He")
self.assertEqual(tokens, ['▁No', '<extra_id_0>', 'H', 'e'])
self.assertEqual(tokens, ["▁No", "<extra_id_0>", "H", "e"])

# Make sure this does not happen if we don't strip
tokenizer = T5Tokenizer(SAMPLE_VOCAB, extra_ids=0)
Expand Down