microsoft / LLMLingua

To speed up LLMs' inference and enhance LLM's perceive of key information, compress the prompt and KV-Cache, which achieves up to 20x compression with minimal performance loss.
https://llmlingua.com/
MIT License
4.42k stars 241 forks source link

[BUG] ratio computation results in `ZeroDivisionError: division by zero` with `compressed_tokens=0` #53

Closed davidberenstein1957 closed 7 months ago

davidberenstein1957 commented 7 months ago

https://github.com/microsoft/LLMLingua/blob/f9304a992e0c65b669825f64bca3db76dbb78e9a/llmlingua/prompt_compressor.py#L285

iofu728 commented 7 months ago

Hi @davidberenstein1957, thank you for your assistance. I have merged this PR.