Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Improve Llama.eval efficiency #1476

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 2 commits into from
May 24, 2024
Merged

Improve Llama.eval efficiency #1476

merged 2 commits into from
May 24, 2024

Conversation

thoughtp0lice
Copy link
Contributor

In llama_cpp/llama.py, the eval function converts return value of self._ctx.get_logits(), which is a CtypesArray, to list then copy it into self.scores. Here the CtypesArray is directly converted to a numpy array which speeds up the conversion and copying. The speed-up is especially noticeable on smaller models with faster inference time.

@thoughtp0lice thoughtp0lice changed the title improve Llama.eval efficiency Improve Llama.eval efficiency May 23, 2024
@abetlen
Copy link
Owner

abetlen commented May 24, 2024

@thoughtp0lice thank you, that's perfect!

@abetlen abetlen merged commit 5cae104 into abetlen:main May 24, 2024
16 checks passed
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