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

Serializing ExLlamaV2TokenEnforcerFilter class #149

Open
UTSAV-44 opened this issue Nov 13, 2024 · 1 comment
Open

Serializing ExLlamaV2TokenEnforcerFilter class #149

UTSAV-44 opened this issue Nov 13, 2024 · 1 comment

Comments

@UTSAV-44
Copy link

I am trying to serialise a object of ExLlamaV2TokenEnforcerFilter class to cache it for future use, but it seems to be not possible. Has anyone of you achieved this?

@noamgat
Copy link
Owner

noamgat commented Nov 30, 2024

the class TokenEnforcerTokenizerData (which can be given to the ExLlamaV2TokenEnforcerFilter constructor instead of ExLlamaV2Tokenizer) is cacheable, and will provide the fast initialization which you are likely trying to achieve. Let me know if this works, or if it doesn't cover your usecase.

So instead of doing

filter = ExLlamaV2TokenEnforcerFilter(parser, tokenizer)

do

tokenizer_data = build_token_enforcer_tokenizer_data(tokenzier)
# save for caching, and load next time
filter = ExLlamaV2TokenEnforcerFilter(parser, tokenizer_data)

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

No branches or pull requests

3 participants
@noamgat @UTSAV-44 and others