10000 Update llama_cpp.py - Fix c_char_p to Array[c_char_p] and c_float to … by viniciusarruda · Pull Request #511 · abetlen/llama-cpp-python · GitHub
[go: up one dir, main page]

Skip to content

Update llama_cpp.py - Fix c_char_p to Array[c_char_p] and c_float to … #511

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

Merged
merged 1 commit into from
Jul 20, 2023
Merged

Update llama_cpp.py - Fix c_char_p to Array[c_char_p] and c_float to … #511

merged 1 commit into from
Jul 20, 2023

Conversation

viniciusarruda
Copy link
Contributor

…Array[c_float]

@abetlen abetlen merged commit a9cb645 into abetlen:main Jul 20, 2023
@viniciusarruda viniciusarruda deleted the patch-1 branch July 20, 2023 22:07
@abetlen
Copy link
Owner
abetlen commented Jul 20, 2023

@viniciusarruda had to revert this because Array is not a valid argtype.

@viniciusarruda
Copy link
Contributor Author

Ok. But to run the following code in my machine worked to use Array, otherwise it will raise type error:

lparams = llama_cpp.llama_context_default_params()

ctx = llama_cpp.llama_init_from_file(str(model_path).encode("utf8"), lparams)

n_vocab = llama_cpp.llama_n_vocab(ctx)

strings = (llama_cpp.c_char_p * n_vocab)()
scores = (llama_cpp.c_float * n_vocab)()
n_vocab = llama_cpp.c_int(n_vocab)

llama_cpp.llama_get_vocab(llama_cpp.llama_context_p(ctx), strings, scores, n_vocab)

antoine-lizee pushed a commit to antoine-lizee/llama-cpp-python that referenced this pull request Oct 30, 2023
applies only to sanitizer builds so they wont be cancelled
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.

2 participants
0