Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
6e6da5e4
Unverified
Commit
6e6da5e4
authored
Aug 24, 2023
by
Arthur
Committed by
GitHub
Aug 24, 2023
Browse files
[`LlamaTokenizer`] make unk_token_length a property (#25689)
make unk_token_length a property
parent
b85b8806
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
src/transformers/models/llama/tokenization_llama.py
src/transformers/models/llama/tokenization_llama.py
+4
-1
No files found.
src/transformers/models/llama/tokenization_llama.py
View file @
6e6da5e4
...
...
@@ -154,7 +154,10 @@ class LlamaTokenizer(PreTrainedTokenizer):
self
.
use_default_system_prompt
=
use_default_system_prompt
self
.
sp_model
=
self
.
get_spm_processor
()
self
.
unk_token_length
=
len
(
self
.
sp_model
.
encode
(
str
(
self
.
unk_token
)))
@
property
def
unk_token_length
(
self
):
return
len
(
self
.
sp_model
.
encode
(
str
(
self
.
unk_token
)))
# Copied from transformers.models.t5.tokenization_t5.T5Tokenizer.get_spm_processor
def
get_spm_processor
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment