|
|
--- |
|
|
license: other |
|
|
--- |
|
|
|
|
|
# Qwen3-pruned-6L-from-0.6B-int8-ov |
|
|
## Description |
|
|
|
|
|
This is a pruned model, originating from the [Qwen/Qwen3-0.6B](https://huggingface.co/Qwen/Qwen3-0.6B). |
|
|
The model was built to accompany [Qwen/Qwen3-8B](https://huggingface.co/Qwen/Qwen3-8B) and to be used as a draft model in the context of Speculative Decoding. |
|
|
|
|
|
The pruning was performed by applying the findings from recent layer-wise pruning research, see [one](https://arxiv.org/abs/2403.17887) of the relevant publications, |
|
|
followed by the accuracy recovery fine-tuning over synthetic data generated by the target model Qwen/Qwen3-8B. |
|
|
|
|
|
Qwen3-pruned-6L-from-0.6B-int8-ov is a model converted to the [OpenVINO™ IR](https://docs.openvino.ai/2024/documentation/openvino-ir-format.html) (Intermediate Representation) format with weights compressed to int8 by [NNCF](https://github.com/openvinotoolkit/nncf). |
|
|
|
|
|
## Quantization Parameters |
|
|
|
|
|
Weight compression was performed using `nncf.compress_weights` with the following parameters: |
|
|
* mode: **INT8_ASYM** |
|
|
|
|
|
For more information on quantization, check the [OpenVINO model optimization guide](https://docs.openvino.ai/2024/openvino-workflow/model-optimization-guide/weight-compression.html). |
|
|
|
|
|
## Compatibility |
|
|
|
|
|
The provided OpenVINO™ IR model is compatible with: |
|
|
|
|
|
* OpenVINO version **2025.2** and higher |
|
|
* Optimum Intel **1.25.3** and higher |
|
|
|
|
|
## Running Model Inference with OpenVINO GenAI |
|
|
|
|
|
1. Install packages required for using [OpenVINO GenAI](https://github.com/openvinotoolkit/openvino.genai) with Speculative decoding: |
|
|
|
|
|
```bash |
|
|
pip install -U "openvino-genai>=2025.2.0" huggingface_hub |
|
|
``` |
|
|
|
|
|
2. Download models from HuggingFace Hub |
|
|
```python |
|
|
import huggingface_hub as hf_hub |
|
|
|
|
|
main_model_id = "OpenVINO/Qwen3-8B-int4-ov" |
|
|
draft_model_id = "OpenVINO/Qwen3-pruned-6L-from-0.6B-int8-ov" |
|
|
|
|
|
main_model_path = "main" |
|
|
draft_model_path = "draft" |
|
|
|
|
|
hf_hub.snapshot_download(main_model_id, local_dir=main_model_path) |
|
|
hf_hub.snapshot_download(draft_model_id, local_dir=draft_model_path) |
|
|
``` |
|
|
3. Run model inference using the speculative decoding and specify the pipeline parameters: |
|
|
```python |
|
|
import openvino_genai |
|
|
|
|
|
prompt = "What is OpenVINO?" |
|
|
|
|
|
config = openvino_genai.GenerationConfig() |
|
|
config.num_assistant_tokens = 3 |
|
|
config.max_new_tokens = 128 |
|
|
|
|
|
def streamer(subword): |
|
|
print(subword, end='', flush=True) |
|
|
return False |
|
|
|
|
|
main_device = "CPU" |
|
|
draft_device = "CPU" |
|
|
|
|
|
draft_model = openvino_genai.draft_model(draft_model_path, draft_device) |
|
|
|
|
|
scheduler_config = openvino_genai.SchedulerConfig() |
|
|
scheduler_config.cache_size = 2 |
|
|
|
|
|
|
|
|
pipe = openvino_genai.LLMPipeline(main_model_path, main_device, scheduler_config=scheduler_config, draft_model=draft_model) |
|
|
|
|
|
pipe.generate(prompt, config, streamer) |
|
|
``` |
|
|
|
|
|
More GenAI usage examples can be found in OpenVINO GenAI library [docs](https://github.com/openvinotoolkit/openvino.genai/blob/master/src/README.md) and [samples](https://github.com/openvinotoolkit/openvino.genai/tree/master/samples) |
|
|
|
|
|
## Legal Information |
|
|
|
|
|
The model is distributed under the [Intel Research Use License Agreement](https://huggingface.co/OpenVINO/Qwen3-pruned-6L-from-0.6B-int8-ov/blob/main/LICENSE.md). |
|
|
|
|
|
The original model is distributed under [Apache License Version 2.0](https://huggingface.co/Qwen/Qwen3-0.6B/blob/main/LICENSE) license. More details can be found in [Qwen3-0.6B](https://huggingface.co/Qwen/Qwen3-0.6B). |
|
|
|
|
|
## Disclaimer |
|
|
|
|
|
Intel is committed to respecting human rights and avoiding causing or contributing to adverse impacts on human rights. See [Intel’s Global Human Rights Principles](https://www.intel.com/content/dam/www/central-libraries/us/en/documents/policy-human-rights.pdf). Intel’s products and software are intended only to be used in applications that do not cause or contribute to adverse impacts on human rights. |