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

Larger states #57

Merged
merged 2 commits into from
Jul 24, 2023
Merged

Larger states #57

merged 2 commits into from
Jul 24, 2023

Conversation

martindevans
Copy link
Member

This builds on my previous PR #56, review that first!

Implemented a new LlamaModel.State handle which internally stores the state as natively allocated memory. This allows it to exceed the 2GB limit on C# arrays.

…mentations map the file into memory and then pass the pointer directly into the native API. This improves things in two ways:

 - A C# array cannot exceed 2,147,483,591 bytes. In my own use of LlamaSharp I encountered this limit.
 - This saves an extra copy of the entire state data into a C# `byte[]`, so it should be faster.

This does _not_ fix some other places where `GetStateData` is used. I'll look at those in a separate PR.
…he state as natively allocated memory. This allows it to exceed the 2GB limit on C# arrays.
@AsakusaRinne AsakusaRinne merged commit 66d6b00 into SciSharp:master Jul 24, 2023
@martindevans martindevans deleted the larger_states branch July 24, 2023 15:14
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.

None yet

2 participants