|
--- |
|
license: apache-2.0 |
|
base_model: |
|
- HuggingFaceTB/SmolLM3-3B |
|
pipeline_tag: text-generation |
|
library_name: optimum-executorch |
|
tags: |
|
- executorch |
|
- transformers |
|
- optimum-executorch |
|
- smollm |
|
--- |
|
|
|
[HuggingFaceTB/SmolLM3-3B](https://huggingface.co/HuggingFaceTB/SmolLM3-3B) is quantized using [torchao](https://huggingface.co/docs/transformers/main/en/quantization/torchao) with 8-bit embeddings and 8-bit dynamic activations with 4-bit weight linears (`8da4w`). It is then lowered to [ExecuTorch](https://github.com/pytorch/executorch) with several optimizations—custom SPDA, custom KV cache, and parallel prefill—to achieve high performance on the CPU backend, making it well-suited for mobile deployment. |
|
|
|
We provide the [.pte file](https://huggingface.co/pytorch/SmolLM3-3B-8da4w/blob/main/smollm3-3b-8da4w.pte) for direct use in ExecuTorch. *(The provided pte file is exported with the default max_seq_length/max_context_length of 2k.)* |
|
|
|
# Running in a mobile app |
|
The [.pte file](https://huggingface.co/pytorch/SmolLM3-3B-8da4w/blob/main/smollm3-3b-8da4w.pte) can be run with ExecuTorch on a mobile phone. See the instructions for doing this in [iOS](https://pytorch.org/executorch/main/llm/llama-demo-ios.html) and [Android](https://docs.pytorch.org/executorch/main/llm/llama-demo-android.html). |
|
|
|
On Google's Pixel 8 Pro, the model runs at 12.7 tokens/s. |
|
|
|
# Running with ExecuTorch’s sample runner |
|
You can also run this model using ExecuTorch’s sample runner following [Step 3&4 in this instruction](https://github.com/pytorch/executorch/blob/main/examples/models/llama/README.md#step-3-run-on-your-computer-to-validate). |
|
|
|
|
|
# Export Recipe |
|
You can re-create the `.pte` file from eager source using this export recipe. |
|
|
|
First install `optimum-executorch` by following this [instruction](https://github.com/huggingface/optimum-executorch?tab=readme-ov-file#-quick-installation), then you can use `optimum-cli` to export the model to ExecuTorch: |
|
```Shell |
|
optimum-cli export executorch \ |
|
--model HuggingFaceTB/SmolLM3-3B \ |
|
--task text-generation \ |
|
--recipe xnnpack \ |
|
--use_custom_sdpa \ |
|
--use_custom_kv_cache \ |
|
--qlinear \ |
|
--qembedding \ |
|
--output_dir ./smollm3_3b |
|
``` |
|
|
|
|
|
# Disclaimer |
|
PyTorch has not performed safety evaluations or red teamed the quantized models. Performance characteristics, outputs, and behaviors may differ from the original models. Users are solely responsible for selecting appropriate use cases, evaluating and mitigating for accuracy, safety, and fairness, ensuring security, and complying with all applicable laws and regulations. |
|
|
|
Nothing contained in this Model Card should be interpreted as or deemed a restriction or modification to the licenses the models are released under, including any limitations of liability or disclaimers of warranties provided therein. |