Add ExecuTorch WebGPU program for qwen2.5-0.5b-instruct
Browse files
README.md
CHANGED
|
@@ -5,6 +5,7 @@ base_model:
|
|
| 5 |
base_model_relation: quantized
|
| 6 |
library_name: executorch
|
| 7 |
pipeline_tag: text-generation
|
|
|
|
| 8 |
tags:
|
| 9 |
- executorch
|
| 10 |
- webgpu
|
|
@@ -15,14 +16,42 @@ tags:
|
|
| 15 |
|
| 16 |
This repository contains an [ExecuTorch](https://github.com/pytorch/executorch) conversion of
|
| 17 |
[Qwen/Qwen2.5-0.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct) for the ExecuTorch **WebGPU** backend, so the model runs entirely in a web browser on
|
| 18 |
-
the visitor's GPU. It powers the corresponding demo in the
|
| 19 |
-
ExecuTorch WebGPU Playground (launching soon on [executorch.ai](https://executorch.ai)).
|
| 20 |
|
| 21 |
- **Base model:** [Qwen/Qwen2.5-0.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct)
|
| 22 |
- **Format:** ExecuTorch `.pte` programs delegated to the WebGPU backend
|
| 23 |
- **Quantization:** 4-bit groupwise weights (q4gsw), fp16 KV cache
|
| 24 |
- **Total size:** 296.5 MB
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
## Files
|
| 27 |
|
| 28 |
| File | Size | SHA-256 |
|
|
@@ -39,10 +68,13 @@ Full checksums are in `manifest.json`. The playground verifies them after downlo
|
|
| 39 |
|
| 40 |
## Running it
|
| 41 |
|
| 42 |
-
These programs
|
| 43 |
-
([backends/webgpu](https://github.com/pytorch/executorch/tree/main/backends/webgpu))
|
| 44 |
-
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
## Provenance
|
| 48 |
|
|
@@ -51,6 +83,20 @@ which downloads these files once, caches them in the browser, and runs everythin
|
|
| 51 |
- **Reproduce:** `python recipes/qwen2.5-0.5b-instruct.py --out out/qwen2.5-0.5b-instruct` (recipe in `export/`)
|
| 52 |
- Re-running the recipe produces byte-identical files.
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
## License
|
| 55 |
|
| 56 |
This is a derivative of the upstream model and is distributed under the same terms
|
|
|
|
| 5 |
base_model_relation: quantized
|
| 6 |
library_name: executorch
|
| 7 |
pipeline_tag: text-generation
|
| 8 |
+
inference: false
|
| 9 |
tags:
|
| 10 |
- executorch
|
| 11 |
- webgpu
|
|
|
|
| 16 |
|
| 17 |
This repository contains an [ExecuTorch](https://github.com/pytorch/executorch) conversion of
|
| 18 |
[Qwen/Qwen2.5-0.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct) for the ExecuTorch **WebGPU** backend, so the model runs entirely in a web browser on
|
| 19 |
+
the visitor's GPU. It powers the corresponding demo in the ExecuTorch WebGPU Playground (launching soon on [executorch.ai](https://executorch.ai)).
|
|
|
|
| 20 |
|
| 21 |
- **Base model:** [Qwen/Qwen2.5-0.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct)
|
| 22 |
- **Format:** ExecuTorch `.pte` programs delegated to the WebGPU backend
|
| 23 |
- **Quantization:** 4-bit groupwise weights (q4gsw), fp16 KV cache
|
| 24 |
- **Total size:** 296.5 MB
|
| 25 |
|
| 26 |
+
## About the original model
|
| 27 |
+
|
| 28 |
+
The 0.5B instruction-tuned model of the Qwen2.5 family.
|
| 29 |
+
|
| 30 |
+
- **Developed by:** Qwen Team, Alibaba Cloud
|
| 31 |
+
- **Paper:** [Qwen2.5 Technical Report](https://arxiv.org/abs/2412.15115)
|
| 32 |
+
- 0.49B parameters, 24 layers
|
| 33 |
+
- Context length 32,768 tokens; generation up to 8,192 tokens
|
| 34 |
+
- Supports over 29 languages
|
| 35 |
+
|
| 36 |
+
For training data, evaluation results and full details, see the original model card: [Qwen/Qwen2.5-0.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct).
|
| 37 |
+
|
| 38 |
+
## Intended use and limitations
|
| 39 |
+
|
| 40 |
+
Chat and instruction following in a small footprint.
|
| 41 |
+
|
| 42 |
+
Small language models can state false information confidently, repeat themselves, and reflect biases in their training data. Check important outputs.
|
| 43 |
+
|
| 44 |
+
## What changed in this conversion
|
| 45 |
+
|
| 46 |
+
- Weights quantized to 4-bit groupwise (q4gsw); the KV cache is fp16
|
| 47 |
+
- Context capped at 8,192 tokens (upstream: 32,768)
|
| 48 |
+
|
| 49 |
+
## Inputs and outputs
|
| 50 |
+
|
| 51 |
+
- `forward(tokens int64 [1, 1..512], input_pos int64 [1]) -> logits float32 [1, 151936]` (last position only)
|
| 52 |
+
- The KV cache lives inside the program; call it with up to 512 new tokens at a time, then one token per step
|
| 53 |
+
- Tokenize with the files in `tokenizer/` (the upstream Qwen2.5 tokenizer) and the ChatML template
|
| 54 |
+
|
| 55 |
## Files
|
| 56 |
|
| 57 |
| File | Size | SHA-256 |
|
|
|
|
| 68 |
|
| 69 |
## Running it
|
| 70 |
|
| 71 |
+
These programs were exported with the ExecuTorch WebGPU backend
|
| 72 |
+
([backends/webgpu](https://github.com/pytorch/executorch/tree/main/backends/webgpu)) and validated with the
|
| 73 |
+
WebAssembly runtime build used by the ExecuTorch WebGPU Playground (launching soon on [executorch.ai](https://executorch.ai)). That runtime build is not published yet; until it is,
|
| 74 |
+
the playground is the supported way to run them. It downloads these files once, caches them in the browser,
|
| 75 |
+
and runs everything locally.
|
| 76 |
+
|
| 77 |
+
Requirements: a browser with WebGPU enabled. The language models use the `shader-f16` GPU feature when available and fall back to fp32 math without it.
|
| 78 |
|
| 79 |
## Provenance
|
| 80 |
|
|
|
|
| 83 |
- **Reproduce:** `python recipes/qwen2.5-0.5b-instruct.py --out out/qwen2.5-0.5b-instruct` (recipe in `export/`)
|
| 84 |
- Re-running the recipe produces byte-identical files.
|
| 85 |
|
| 86 |
+
## Citation
|
| 87 |
+
|
| 88 |
+
If you use this model, please cite the original work:
|
| 89 |
+
|
| 90 |
+
```bibtex
|
| 91 |
+
@misc{qwen2.5,
|
| 92 |
+
title={Qwen2.5: A Party of Foundation Models},
|
| 93 |
+
url={https://qwenlm.github.io/blog/qwen2.5/},
|
| 94 |
+
author={Qwen Team},
|
| 95 |
+
month={September},
|
| 96 |
+
year={2024}
|
| 97 |
+
}
|
| 98 |
+
```
|
| 99 |
+
|
| 100 |
## License
|
| 101 |
|
| 102 |
This is a derivative of the upstream model and is distributed under the same terms
|