Skip to content

Implement non-greedy tokenizer that tries to maximize token lengths#242

Merged
thement merged 2 commits into
ggml-org:masterfrom
thement:thement/fix-tokenizer
Mar 17, 2023
Merged

Implement non-greedy tokenizer that tries to maximize token lengths#242
thement merged 2 commits into
ggml-org:masterfrom
thement:thement/fix-tokenizer

Conversation

@thement

@thement thement commented Mar 17, 2023

Copy link
Copy Markdown
Contributor

No description provided.

@Piezoid

Piezoid commented Mar 17, 2023

Copy link
Copy Markdown
Contributor

Although I haven't examined the code, I've tested it on several prompts and can already conclude that this patch allows Llama to write in French.
Previously it spouted nonsense before falling back to english.

@thement thement marked this pull request as ready for review March 17, 2023 17:14
Comment thread utils.cpp Outdated
Comment thread main.cpp Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is the space meant to be a separate token? I noticed that it often get fused with the first user provided token.

@thement thement Mar 17, 2023

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It should be fused to the first token! This is how original python llama code parses it.
I can dig out more details if you want.

@ggerganov ggerganov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Merge it if results look ok.
I won't be able to have detailed look in the next few days

@thement thement merged commit c9f670a into ggml-org:master Mar 17, 2023
mudler pushed a commit to go-skynet/llama that referenced this pull request Mar 17, 2023
…gml-org#242)

* Implement non-greedy tokenizer that tries to maximize token lengths

* Insert single space in front of the prompt

- this is to match original llama tokenizer behavior

---------

Co-authored-by: Jakub Horak <jakub.horak@ibawizard.net>
antimatter15 pushed a commit to antimatter15/alpaca.cpp that referenced this pull request Mar 18, 2023
…gml-org#242)

* Implement non-greedy tokenizer that tries to maximize token lengths

* Insert single space in front of the prompt

- this is to match original llama tokenizer behavior

---------

Co-authored-by: Jakub Horak <jakub.horak@ibawizard.net>
gyohng pushed a commit to gyohng/alpaca.cpp that referenced this pull request Mar 26, 2023
…gml-org#242)

* Implement non-greedy tokenizer that tries to maximize token lengths

* Insert single space in front of the prompt

- this is to match original llama tokenizer behavior

---------

Co-authored-by: Jakub Horak <jakub.horak@ibawizard.net>
Seunghhon pushed a commit to Seunghhon/llama.cpp that referenced this pull request Apr 26, 2026
…gml-org#242)

* Implement non-greedy tokenizer that tries to maximize token lengths

* Insert single space in front of the prompt

- this is to match original llama tokenizer behavior

---------

Co-authored-by: Jakub Horak <jakub.horak@ibawizard.net>
ljubomirj pushed a commit to ljubomirj/llama.cpp that referenced this pull request May 6, 2026
…gml-org#242)

* Implement non-greedy tokenizer that tries to maximize token lengths

* Insert single space in front of the prompt

- this is to match original llama tokenizer behavior

---------

Co-authored-by: Jakub Horak <jakub.horak@ibawizard.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants