text-generation-inference/server/text_generation_server/layers
Daniël de Kok ba291dad9f
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-07-19 09:37:39 +02:00
..
attention Fixing rocm. (#2164) 2024-07-02 12:01:08 +02:00
awq Support AWQ quantization with bias (#2117) 2024-06-25 21:09:00 +02:00
gptq Improve the handling of quantized weights (#2250) 2024-07-19 09:37:39 +02:00
__init__.py Enable multiple LoRa adapters (#2010) 2024-06-25 14:46:27 -04:00
bnb.py Improve the handling of quantized weights (#2250) 2024-07-19 09:37:39 +02:00
conv.py Refactor layers. (#1866) 2024-05-13 12:44:30 +02:00
eetq.py Improve the handling of quantized weights (#2250) 2024-07-19 09:37:39 +02:00
exl2.py Improve the handling of quantized weights (#2250) 2024-07-19 09:37:39 +02:00
fp8.py Improve the handling of quantized weights (#2250) 2024-07-19 09:37:39 +02:00
layernorm.py Removing IPEX_AVAIL. (#2115) 2024-06-25 13:20:57 +02:00
linear.py Improve the handling of quantized weights (#2250) 2024-07-19 09:37:39 +02:00
lora.py Enable multiple LoRa adapters (#2010) 2024-06-25 14:46:27 -04:00
marlin.py Improve the handling of quantized weights (#2250) 2024-07-19 09:37:39 +02:00
medusa.py fix: use path inside of speculator config (#1935) 2024-05-22 20:46:29 +02:00
mlp.py MLPSpeculator. (#1865) 2024-05-14 12:33:18 +02:00
rotary.py [fix] Modifying base in yarn embedding (#2212) 2024-07-12 10:04:51 +02:00
speculative.py MLPSpeculator. (#1865) 2024-05-14 12:33:18 +02:00
tensor_parallel.py Improve the handling of quantized weights (#2250) 2024-07-19 09:37:39 +02:00