text-generation-inference/server/text_generation_server/utils
Daniël de Kok 2dd680b799 Improve the handling of quantized weights (#2250)
* Improve the handling of quantized weights

Handling of quantized weights was split between two mechanisms:

- For quantized checkpoints, we used the new weight loader
  infrastructure.
- For quantization while loading (EETQ, FP8, bitsandbytes) we
  instead relied on conditional in `get_linear`.

Weight loaders support context managers to selectively load
particular layers with different weight loaders, which is useful
for models like Idefics2 AWQ, which uses a quantized text model,
but unquantized vision and connector models. However, the context
manager would be overrided by `get_linear`, which string-checks
`quantizer`. Also, the context manager would not work with
EETQ, FP8, and bitsandbytes.

This change migrates all quantizers to the weight loader infrastructure.
This has several benefits:

- We can use context managers with all quantizers.
- All the implementation details move down to the quantizer layers,
  `get_linear` does not need to know how to handle quantizer linear
  layers.
- All quantizer weights are strongly typed, we don't pass around
  raw tensors.
- We don't have to pass around the `quantizer` string everywhere.

* Exclude non-MLP layers when using FP8 quantization with Llama
2024-09-25 05:27:40 +00:00
..
merges Enable multiple LoRa adapters (#2010) 2024-09-24 03:55:04 +00:00
__init__.py Aligin the source code with main branch 2.0.4 2024-09-24 03:06:55 +00:00
adapter.py Enable multiple LoRa adapters (#2010) 2024-09-24 03:55:04 +00:00
chunks.py server: use chunked inputs 2024-09-24 03:42:29 +00:00
convert.py Force weights_only (before fully breaking pickle files anyway). (#1710) 2024-04-25 15:10:53 +03:00
dist.py Removing IPEX_AVAIL. (#2115) 2024-09-24 03:52:23 +00:00
hub.py Enable multiple LoRa adapters (#2010) 2024-09-24 03:55:04 +00:00
import_utils.py refine get xpu free memory/enable Qwen2/gemma2/gemma/phi in intel platform (#2132) 2024-09-24 03:57:32 +00:00
log.py v1.3.4 2024-04-22 09:08:34 +03:00
logits_process.py Aligin the source code with main branch 2.0.4 2024-09-24 03:06:55 +00:00
peft.py Enable multiple LoRa adapters (#2010) 2024-09-24 03:55:04 +00:00
quantization.py Improve the handling of quantized weights (#2250) 2024-09-25 05:27:40 +00:00
segments.py Enable multiple LoRa adapters (#2010) 2024-09-24 03:55:04 +00:00
sgmv.py Enable multiple LoRa adapters (#2010) 2024-09-24 03:55:04 +00:00
speculate.py chore: formatting 2024-04-18 16:26:00 +03:00
tokens.py Aligin the source code with main branch 2.0.4 2024-09-24 03:06:55 +00:00
watermark.py Aligin the source code with main branch 2.0.4 2024-09-24 03:06:55 +00:00
weights.py Improve the handling of quantized weights (#2250) 2024-09-25 05:27:40 +00:00