Repository navigation
CPU offloading of (quantized) KV cache buffers (#47) - #47
Conversation
[1] cell, then layer, then chunk/cell (we do this right now) Assume: Mem for KV cache = Mem for cell embeddings How many copies CPU/GPU?
[2]
==> Pretty much the same. Stick with [1] Another way to look at it (if quantization is used): [1] Embeddings don't need quant, but caches n_cells * n_layers ==> Easiest to stick with [1]
OK: Do not use code in
Current:
What we need:
Two possibilities:
Like to have "pull", but without complex code change in quantizer! Idea: Callback
|
[1] Eval without offloading [2] Eval with offloading Cool: Produce the same results. Offloading slightly slower, as expected
Also to check whether not wrapping [3] finetune_offload_full without offloading DONE: Fails with NaN after 20 steps, as above. [4] finetune_offload_full with offloading DONE: Fails with NaN after 20 steps, as above. [5] finetune_long_full without offloading DONE: Fails with NaN after 20 steps, as above. [6] finetune_long_full with offloading DONE: Fails with NaN after 20 steps, as above. |
Enables CPU offloading of quantized KV cache buffers, which allows to run inference for bigger models.
This is done by sharing quantizers across all quantized KV cache buffers, but storing the quantizer states per layer to CPU.
Closes #18.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.