hf_text-generation-inference/server/tests/utils
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
..
test_convert.py fix(server): harden the weights choice to save on disk. (#561) 2023-07-07 14:50:12 +02:00
test_hub.py Fix local load for peft (#1373) 2023-12-21 17:29:23 +01:00
test_layers.py Move quantized weight handling out of the `Weights` class (#2194) 2024-07-09 20:04:03 +02:00
test_tokens.py feat(server): add frequency penalty (#1541) 2024-02-08 18:41:25 +01:00
test_watermark.py feat(server): add watermarking tests (#248) 2023-04-27 19:16:35 +02:00
test_weights.py Improve the handling of quantized weights (#2250) 2024-07-19 09:37:39 +02:00