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

Support for KV-cache loading? #8

Open
mark-lord opened this issue Oct 2, 2024 · 0 comments
Open

Support for KV-cache loading? #8

mark-lord opened this issue Oct 2, 2024 · 0 comments

Comments

@mark-lord
Copy link

It's not clear to me from looking at the code if this library supports the following pattern:

mlx_lm.cache_prompt --prompt 'Here are 100 examples of how to produce a desired output: {examples}'

... cachedprompt.safetensors saved to cwd

prompt_template = "Now produce an output from this sentence: {sentence}"
prompts_raw = [prompt_template.format(sentence=sentence) for sentence in sentences]
response = batch_generate(kv-cache-file=cachedprompt.safetensors, prompts=prompts_raw)

... batched generations created

Is this something the library can or could do? I'm interested in being able to provide multi-shot examples without introducing huge prompt processing times due to wasted compute on re-encoding the same pre-prompt

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

1 participant