Add Intel Quantization Support in SGLang (#18139)
Signed-off-by: Mengni Wang <mengni.wang@intel.com> Signed-off-by: WeiweiZhang1 <weiwei1.zhang@intel.com> Co-authored-by: Peng Zhang <aniz1905@gmail.com> Co-authored-by: Ma Mingfei <mingfei.ma@intel.com> Co-authored-by: Weiwei <weiwei1.zhang@intel.com>
This commit is contained in:
co-authored by
Peng Zhang
Ma Mingfei
Weiwei
parent
10ff3c1dcb
commit
cfc0a0e0e0
@@ -385,6 +385,34 @@ auto-round \
|
||||
--output_dir ./tmp_autoround
|
||||
```
|
||||
|
||||
- SGlang API Usage (CPU/CUDA)
|
||||
|
||||
```python Example
|
||||
from sglang.srt.configs.load_config import LoadConfig
|
||||
from sglang.srt.configs.model_config import ModelConfig
|
||||
from sglang.srt.model_loader.loader import get_model_loader
|
||||
from sglang.srt.configs.device_config import DeviceConfig
|
||||
|
||||
# Configure model with inc quantization and saving
|
||||
model_config = ModelConfig(
|
||||
model_path="meta-llama/Llama-3.2-3B-Instruct",
|
||||
quantization="auto-round-int8",
|
||||
trust_remote_code=True,
|
||||
)
|
||||
|
||||
load_config = LoadConfig(
|
||||
inc_save_path="./quantized_model",
|
||||
)
|
||||
device_config = DeviceConfig(device="cpu")
|
||||
|
||||
# Load and quantize the model
|
||||
model_loader = get_model_loader(load_config, model_config)
|
||||
quantized_model = model_loader.load_model(
|
||||
model_config=model_config,
|
||||
device_config=device_config,
|
||||
)
|
||||
```
|
||||
|
||||
- known issues
|
||||
|
||||
Several limitations currently affect offline quantized model loading in sglang, These issues might be resolved in future updates of sglang. If you experience any problems, consider using Hugging Face Transformers as an alternative.
|
||||
@@ -414,6 +442,10 @@ Several limitations currently affect offline quantized model loading in sglang,
|
||||
auto_round:auto_awq and AWQ format: These work as expected.
|
||||
</Accordion>
|
||||
|
||||
4. Limited Support for SGlang API Usage
|
||||
|
||||
SGlang API Usage only supports `auto-round-int8` quantization method now, more quantization methods are on the way.
|
||||
|
||||
#### Using [GPTQModel](https://github.com/ModelCloud/GPTQModel)
|
||||
|
||||
```bash Command
|
||||
@@ -857,6 +889,17 @@ sglang serve --model-path Qwen/Qwen3-30B-A3B \
|
||||
--quantization quark_mxfp4
|
||||
```
|
||||
|
||||
### Intel® Neural Compressor online quantization method
|
||||
|
||||
SGLang supports quantization methods based on the advanced algorithm [auto-round](https://github.com/intel/auto-round) in [Intel® Neural Compressor](https://github.com/intel/neural-compressor). You can simply specify `--quantization auto-round-int8` to use this feature. It will quantize the model on the fly to target format. More online quantization methods are on the way.
|
||||
|
||||
##### Available Quantization Methods
|
||||
|
||||
| Quantization Method | Schemes | Validated Hardware Environment |
|
||||
|:--------------------|:--------|:-------------------------------|
|
||||
| auto-round-int8 |INT8 per-channel quantized weight <br /> INT8 per-token dynamic quantized activation | Intel Xeon Scalable processor <br /> Nvidia A100 GPU |
|
||||
|
||||
|
||||
## Diffusion Model Quantization on Ascend NPU
|
||||
|
||||
SGLang-Diffusion supports MXFP8 quantization for diffusion models (such as Wan2.2) on Ascend A5 NPUs, in both online and offline (ModelSlim) modes. This is separate from the LLM serving path and uses the `sglang serve` / `sglang generate` CLI.
|
||||
|
||||
Reference in New Issue
Block a user