Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
KV Cache injection support for a BLOOM model
Usage
A sample script to inject KV Cache (create
model_kvcache.onnx
frommodel.onnx
(model exported fromsparseml.transformers.export
)Feature Preview
Using the
model_kvcache.onnx
we can run the inference using deepsparse pipeline. The manual tests run as expected:(using the deepsparse branch neuralmagic/deepsparse#1083 for testing)
2023-07-12 09:29:46 deepsparse.transformers.engines.nl_decoder_engine INFO Overwriting in-place the input shapes of the transformer model at /home/ubuntu/damian/sparseml/deployment/model.onnx 2023-07-12 09:29:46 deepsparse.utils.onnx INFO Overwriting in-place the batch size of the model at /home/ubuntu/damian/sparseml/deployment/model.onnx 2023-07-12 09:29:47 deepsparse.transformers.engines.nl_decoder_engine INFO Overwriting in-place the input shapes of the transformer model at /home/ubuntu/damian/sparseml/deployment/model.onnx 2023-07-12 09:29:47 deepsparse.utils.onnx INFO Overwriting in-place the batch size of the model at /home/ubuntu/damian/sparseml/deployment/model.onnx Who is the president of the United States?” “Mr. President, I am the president of the United States.” “Mr. President, I am the president of the United States.” “Mr. President, I am the president of the United States.” “Mr. President, I am the president of the United States.” “Mr. President, I am the president of the United States.” “Mr. President, I am the president of the United States.” “Mr. President, I am the president of the United States.” “Mr. President, I am the president of the United States. ------------------- Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is the president of the United States?Who is -------------------
Testing with perplexity values
Perplexity values do not match ground truth, this has been true for both CodeGen and BLOOM models (perhaps some problems with the lack of BOS token? OPT perplexity works fine). Looking into it now.
Ground truth (perplexity ignoring BOS token)
Perplexity (KV Cache model)
Perplexity (Non KV Cache model)