Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
915cce39
Unverified
Commit
915cce39
authored
Jun 26, 2024
by
Marc Sun
Committed by
GitHub
Jun 26, 2024
Browse files
Fix llama gguf converter (#31575)
parent
b07770c5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
1 deletion
+21
-1
src/transformers/integrations/ggml.py
src/transformers/integrations/ggml.py
+21
-1
No files found.
src/transformers/integrations/ggml.py
View file @
915cce39
...
@@ -632,7 +632,27 @@ class GGUFLlamaConverter(LlamaConverter):
...
@@ -632,7 +632,27 @@ class GGUFLlamaConverter(LlamaConverter):
return
decoders
.
Sequence
(
sequence
)
return
decoders
.
Sequence
(
sequence
)
def
converted
(
self
):
def
converted
(
self
):
tokenizer
=
super
().
converted
()
# Copied partly from converted method in SpmConverter class
tokenizer
=
self
.
tokenizer
(
self
.
proto
)
# Tokenizer assemble
normalizer
=
self
.
normalizer
(
self
.
proto
)
if
normalizer
is
not
None
:
tokenizer
.
normalizer
=
normalizer
replacement
=
"▁"
add_prefix_space
=
True
if
hasattr
(
self
.
original_tokenizer
,
"add_prefix_space"
):
add_prefix_space
=
self
.
original_tokenizer
.
add_prefix_space
pre_tokenizer
=
self
.
pre_tokenizer
(
replacement
,
add_prefix_space
)
if
pre_tokenizer
is
not
None
:
tokenizer
.
pre_tokenizer
=
pre_tokenizer
tokenizer
.
decoder
=
self
.
decoder
(
replacement
,
add_prefix_space
)
post_processor
=
self
.
post_processor
()
if
post_processor
:
tokenizer
.
post_processor
=
post_processor
# HACK: patch the llama-3 tokenizer to use the correspinding pre-tokenizer
# HACK: patch the llama-3 tokenizer to use the correspinding pre-tokenizer
# and normalizer
# and normalizer
...
...
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