Commit Graph

620 Commits

Author SHA1 Message Date
Daniël de Kok
247a29f77c server quantize: store quantizer config in standard format (#2299)
- Create `quantization_config` option in the model config.
- Don't store the quantizer config in tensors anymore.
2024-09-25 05:50:17 +00:00
Erik Kaunismäki
b1d1d26559 patch-error-on-invalid-grammar (#2282)
* quick fix

* allow silent failure

* explicit todo that this is only short term
2024-09-25 05:50:17 +00:00
Daniël de Kok
23a3927eb6 Install Marlin from standalone package (#2320) 2024-09-25 05:50:17 +00:00
drbh
a87791d7c9 feat: add ruff and resolve issue (#2262)
* feat: add ruff and resolve issue

* fix: update client exports and adjust after rebase

* fix: adjust syntax to avoid circular import

* fix: adjust client ruff settings

* fix: lint and refactor import check and avoid model enum as global names

* fix: improve fbgemm_gpu check and lints

* fix: update lints

* fix: prefer comparing model enum over str

* fix: adjust lints and ignore specific rules

* fix: avoid unneeded quantize check
2024-09-25 05:46:24 +00:00
Daniël de Kok
fc6d80fdb8 Support tied embeddings in 0.5B and 1.5B Qwen2 models (#2313) 2024-09-25 05:41:43 +00:00
Adrien
1674f441d0 Fix registry name (#2307) 2024-09-25 05:41:43 +00:00
Daniël de Kok
64ffd642fa Some small fixes for the Torch 2.4.0 update (#2304)
* Fix GPTQ autotune data type to be compatible with Torch 2.4.0

* Update poetry lock file

* Fix small PaliGemma logprob differences after the torch update
2024-09-25 05:40:25 +00:00
drbh
7ebee37641 fix: refactor adapter weight loading and mapping (#2193)
* fix: refactor adapter weight loading and mapping

* feat: enable lora load from directory

* fix: adjust launcher for local lora adapters

* feat: improve weight loading and add tests

* fix: improve logging and rebase syntax issue

* fix: impove adapter merge comments and remove unused conditional

* fix: improve get_model_with_lora_adapters naming

* fix: comment typo
2024-09-25 05:39:58 +00:00
Daniël de Kok
457791f511 Split up layers.marlin into several files (#2292)
The marlin.py file was getting large, split it up.
2024-09-25 05:39:58 +00:00
Wang, Yi
d93931567d fix of use of unquantized weights in cohere GQA loading, also enable … (#2291)
fix of use of unquantized weights in cohere GQA loading, also enable the model in intel platform

Signed-off-by: Wang, Yi A <yi.a.wang@intel.com>
2024-09-25 05:39:58 +00:00
Wang, Yi
204142153f fix crash in multi-modal (#2245)
* fix crash in multi-modal

Signed-off-by: Wang, Yi A <yi.a.wang@intel.com>

* update according to review comment

Signed-off-by: Wang, Yi A <yi.a.wang@intel.com>

* fix llava_next regression in latest main

Signed-off-by: Wang, Yi A <yi.a.wang@intel.com>

---------

Signed-off-by: Wang, Yi A <yi.a.wang@intel.com>
2024-09-25 05:39:58 +00:00
OlivierDehaene
a994f6aedd hotfix: update nccl 2024-09-25 05:39:58 +00:00
OlivierDehaene
34c472bd64 chore: update to torch 2.4 (#2259)
* chore: update to torch 2.4

* remove un-necessary patch

* fix
2024-09-25 05:39:14 +00:00
Daniël de Kok
b1077b077c hotfix: pin numpy (#2289) 2024-09-25 05:38:48 +00:00
Daniël de Kok
43f49141fd Add support for Llama 3 rotary embeddings (#2286)
* Add support for Llama 3 rotary embeddings

* Update transformers to 4.43
2024-09-25 05:38:48 +00:00
shaltielshmid
69b67b7add Add support for Mistral-Nemo by supporting head_dim through config (#2254)
* Support passing head_dim through config

* Using `head_dim` as a fallback is necessary since it's a non standard
key in mistralConfig (as defined in transformers).

* Shorter diff.

---------

Co-authored-by: Nicolas Patry <patry.nicolas@protonmail.com>
2024-09-25 05:31:31 +00:00
Daniël de Kok
26460f053d Add support for repacking AWQ weights for GPTQ-Marlin (#2278)
* Add support for repacking AWQ weights for GPTQ-Marlin

So far we couldn't support AWQ because virtually all AWQ models use
symmetric quantization, which GPTQ-Marlin did not suppors. GPTQ-Marlin
has recently added support AWQ repacking and AWQ asymmetric quantization
(zero_point=True).

This change updates all GPTQ-Marlin kernels from upstream and wires up
AWQ support. For now enabling AWQ using Marlin requires running TGI with
`--quantize gptq`.

* Enable Marlin for supported AWQ configurations by default

This makes the AWQ -> GPTQ repack test redundant, since we are now
testing this with the regular AWQ test.
2024-09-25 05:31:31 +00:00
OlivierDehaene
919da25c3b fix(l4): fix fp8 logic on l4 (#2277)
* fix(l4): fix fp8 logic on l4

* also quant weights with single scale

* use marlin even on 89
2024-09-25 05:31:30 +00:00
Nicolas Patry
31eb03dbe2 Fixing mistral nemo. (#2276) 2024-09-25 05:31:30 +00:00
Nicolas Patry
568cc9f3d0 Softcapping for gemma2. (#2273)
* Softcapping for gemma2.

* Less clutter.

* No access to transformers config, only config_dict here.

* 0.0 is the null value in the C++ API.
2024-09-25 05:31:08 +00:00
OlivierDehaene
a7515b8af1 fix(server): fix fp8 weight loading (#2268)
* fix(server): fix fp8 weight loading

* fixed scales loading

* update snap

* revert default dtype
2024-09-25 05:31:08 +00:00
icyboy™
a5aee82a69 Hotfix: fix of use of unquantized weights in Mixtral GQA loading (#2269)
* Update idefics_causal_lm.py

Fix syntax issues

* fix dbrx & opt model prefix bug

* Hotfix: fix of use of unquantized weights in Mixtral GQA loading
2024-09-25 05:30:41 +00:00
OlivierDehaene
d13215da8f fix(server): fix deepseekv2 loading (#2266) 2024-09-25 05:30:41 +00:00
OlivierDehaene
85f10ec5c9 feat(fp8): use fbgemm kernels and load fp8 weights directly (#2248)
* feat(fp8): add support for fbgemm

* allow loading fp8 weights directly

* update outlines

* fix makefile

* build fbgemm

* avoid circular import and fix dockerfile

* add default dtype

* refactored weights loader

* fix auto conversion

* fix quantization config parsing

* force new nccl on install

* missing get_weights implementation

* increase timeout
2024-09-25 05:30:41 +00:00
Daniël de Kok
c1638a56f1 Add support for Deepseek V2 (#2224)
Deepseek V2 is a MoE model from Deepseek. Relevant variations
compared to other models:

- Grouped top-K in expert selection.
- mscale in yarn is calculated using the `mscale` and `mscale_all_dim`
  configuration options.
- `mscale_all_dim` is also used in scaling attention softmax.
- Permuting of the query/key representations before applying rotary
  embeddings.
- Some projections cannot be sharded (`q_a_proj`, `kv_a_proj_with_mqa`).
  So, we need weight loads that supports quantized weights. To this
  end `{Weights,WeightLoader}.get_weight` was added.
- The query/key head dimensionality differs from that of the value,
  so we need to pad during attention.
- Heads with size 192, needs an extension to our paged attention
  fork and we need to ensure that the KV cache is allocated with the
  correct size.
- Shared experts.
2024-09-25 05:27:40 +00:00
Daniël de Kok
e658d95c23 Hotfix: pass through model revision in VlmCausalLM (#2258) 2024-09-25 05:27:40 +00:00
Daniël de Kok
990ea793c0 Hotfix: fix MPT after recent refactor (#2257) 2024-09-25 05:27:40 +00:00
Daniël de Kok
ba0dfb6fb1 Hotfix: various GPT-based model fixes (#2256) 2024-09-25 05:27:40 +00:00
Daniël de Kok
394f8c7d2b Hotfix: fix of use of unquantized weights in Gemma GQA loading (#2255) 2024-09-25 05:27:40 +00:00
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
OlivierDehaene
118ee57f82 fix(server): fix cohere (#2249) 2024-09-25 05:27:40 +00:00
Daniël de Kok
e0710ccbeb Remove stray quantize argument in get_weights_col_packed_qkv (#2237)
Fixes #2236.
2024-09-25 05:27:40 +00:00
Daniël de Kok
7177da0df6 server quantize: expose groupsize option (#2225) 2024-09-25 05:27:40 +00:00
Daniël de Kok
e955f7b536 Add support for AWQ-quantized Idefics2 (#2233)
Fixes #2036.
2024-09-25 05:27:40 +00:00
Hugo Larcher
8a223eb6ac fix: Remove bitsandbytes installation when running cpu-only install (#2216)
Remove bitsandbytes installation when running cpu-only install
2024-09-25 05:27:40 +00:00
drbh
619eeded47 feat: simple mistral lora integration tests (#2180)
* feat: simple mistral lora integration tests

* fix: include args in docker launcher

* fix: disable cuda graphs with lora and warn

* fix: adjust docs and precommit issues

* fix: re update docs
2024-09-25 05:27:40 +00:00
Daniël de Kok
ee56266044 Use symmetric quantization in the quantize subcommand (#2120)
Packing of asymmetric quantization is broken, all (q)zeros values
of `0` get reset to `1`, resulting in a loss of accuracy. So instead
use symmetric quantization. To be able to distinguish models with
symmetric and asymmetric quantization, a new config tensor `gptq_sym` is
added. If this tensor is not present, we assume `sym=False`.
2024-09-25 05:27:40 +00:00
SeongBeomLEE
dedeb3cfa0 Modifying base in yarn embedding (#2212) 2024-09-25 05:27:40 +00:00
Daniël de Kok
85c3c5d64f Add support for FP8 on compute capability >=8.0, <8.9 (#2213)
Use FP8 GPTQ-Marlin kernels to enable FP8 support on CUDA GPUs
with compute capability >=8.0 and <8.9.

Co-authored-by: Florian Zimmermeister <flozi00.fz@gmail.com>
2024-09-25 05:27:40 +00:00
Daniël de Kok
2a6c3caf1d Move quantized weight handling out of the Weights class (#2194)
Quantized weights were loaded in the `Weights` class, but this was
getting quite unwieldy, where every higher level method to load weights
was a long conditional to cover all the different quantizers.

This change moves loading of quantized weights out of the `Weights`
class. This is done by defining a simple `WeightsLoader` interface
that is implemented by `Exl2WeightsLoader`, `GPTQWeightsLoader`,
and `MarlinWeightsLoader`. These implementations are in the quantizers'
respective modules. The `Weights` class provides the low-level load
operations (such as loading tensors or sharded tensors), but delegates
loads that need quantizer-specific weight processing to a loader. The
loaders still use the low-level functionality provided by `Weights`.

I initially tried making a hierarchy where a class like `GPTQWeights`
would inherit from `Weights`. But it is not very flexible (e.g. does
not work well with the new weight storage mock used in tests) and
the implicit indirections made the code harder to follow.
2024-09-25 05:27:40 +00:00
fxmarty
eaaea91e2b Fix nccl regression on PyTorch 2.3 upgrade (#2099)
* fix nccl issue

* add note in dockerfile

* use v2.22.3 that also fixes @samsamoa's repro

* poetry actually can't handle the conflict between torch and nccl

* set LD_PRELOAD
2024-09-25 05:22:56 +00:00
Daniël de Kok
540e710c3f Falcon/DBRX: get correct number of key-value heads (#2205) 2024-09-25 05:21:34 +00:00
Daniël de Kok
17594916ed Fix incorrect cache allocation with multi-query (#2203)
We wouldn't allocate any memory in multi-query (1 KV head). Fixes
Starcoder et al.
2024-09-25 05:21:34 +00:00
Daniël de Kok
f11fd699b6 hotfix: Fix number of KV heads (#2202)
Fix number of KV heads
2024-09-25 05:21:34 +00:00
icyboy™
8e3d1e6c3f fix dbrx & opt model prefix bug (#2201)
* Update idefics_causal_lm.py

Fix syntax issues

* fix dbrx & opt model prefix bug
2024-09-25 05:21:34 +00:00
Daniël de Kok
508e308088 Consistently take prefix in model constructors (#2191)
* Consistently take `prefix` in model constructors

* Release test check fix

* Misc refactor-related fixes
2024-09-25 05:21:34 +00:00
Daniël de Kok
1e7ce69f20 Fix Starcoder2 after refactor (#2189) 2024-09-25 05:20:28 +00:00
Nicolas Patry
e481a9bb9b Hotfixing after refactor. 2024-09-25 05:20:28 +00:00
Nicolas Patry
1b434e8019 Refactor dead code - Removing all flash_xxx.py files. (#2166)
* Refactor dead code.

* First working step.

* Remove a lot of duplicated code.

* More dead code.

* More cleanup.

* Fix Santacoder test.

* Fixing the simple tests.

* Fixing sharding.

* Fixes for VLM.

* Fixing santacoder (num_kv_heads hardcoded).

* Removing more dead code.

* Fixing `config.n_head`.

* Stopping earlier because of `<end_of_utterance>` in idefics2.

* Addresses comments.

* Removing the dead code.

* Fuse back mistral into FlashCausalLM.

* Finish removal.

* Fixing docs + causal_lm `batch_class`.

* Fixing docs + causal.lm.

* Add default to Gemma Causality.

* Default value for gemma/gemma2.

* Wrong default.
2024-09-25 05:20:28 +00:00
Aaron Mihalik
835ad0a923 Adding "longrope" for Phi-3 (#2172) (#2179)
Adding "longrope" for phi-3
2024-09-24 04:08:02 +00:00