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

Ensure models.llamacpp Doesn't Have Implicit max_tokens #996

Merged
merged 1 commit into from
Jun 24, 2024

Conversation

lapp0
Copy link
Contributor

@lapp0 lapp0 commented Jun 21, 2024

Fixes #973

Problem

In #973 an invalid pattern was being generated, however it was only invalid because it was incomplete. in the LlamaCpp.generate() call llama_cpp_params["max_tokens"] was unset, however the model was still finishing for reason "length":

[{'text': '{ "name": "Grace Lee", "age":32, "', 'index': 0, 'logprobs': None, 'finish_reason': 'length'}]                                                                                                         

In turns out the max tokens was being implicitly set to 30.

Solution

Allow 2**30 tokens if max_length is unset /None, because llama_cpp_params requires an int for the max_tokens field.

@lapp0 lapp0 added the llama.cpp Related to the `llama.cpp` integration label Jun 21, 2024
@lapp0 lapp0 marked this pull request as ready for review June 22, 2024 22:14
@lapp0 lapp0 requested a review from rlouf June 22, 2024 22:15
@rlouf rlouf merged commit 42206e2 into dottxt-ai:main Jun 24, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
llama.cpp Related to the `llama.cpp` integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid generate.json Output with models.llamacpp
2 participants