11---
22title : Litespark-Inference
3- draft : true
43
54description : Install Litespark-Inference on Arm or x86 Linux and Apple silicon macOS to run BitNet ternary LLMs on the CPU.
65
@@ -44,18 +43,24 @@ single `pip install` reads your CPU's feature flags and compiles the
4443right C++ kernel for it using NEON and SDOT on Arm or AVX-512/VNNI and AVX2+FMA
4544on x86. This saves you from needing to pick the right C++ kernel for best performance.
4645
47- ## What do I need before installing Litespark-Inference?
46+ You can install Litespark-Inference on Linux and macOS.
4847
49- - Python 3.10 or newer, you can run ` python3 --version ` to check your version
48+ ## Before you begin
49+
50+ Before installing Litespark-Inference, make sure your local machine has the following:
51+
52+ - Python 3.10 or later
5053- A C++ toolchain such as ` clang ` or ` g++ `
5154- About 5 GB of free disk
5255
56+ To check the Python version on your machine, run ` python3 --version ` .
57+
5358The BitNet-2B model is downloaded from Hugging Face on your first run.
5459
55- It is good practice to install into a clean virtual environment so the
56- install does not conflict with anything else on your machine:
60+ It's a good practice to install into a clean virtual environment so the
61+ install doesn't conflict with anything else on your machine:
5762
58- If you don't have Python virtual environment support installed run:
63+ If you don't have Python virtual environment support installed, run:
5964
6065``` bash
6166sudo apt update
@@ -70,24 +75,28 @@ source .venv/bin/activate
7075python -m pip install --upgrade pip wheel setuptools
7176```
7277
73- Next, follow the section for your platform, Linux or macOS.
74-
75- ## How do I install Litespark-Inference on Arm Linux?
78+ ## Install Litespark-Inference on Arm Linux
7679
7780The released package builds the correct kernel for your CPU
78- automatically. It uses NEON and
79- SDOT on Arm (Graviton 2/3/4, Ampere, Neoverse N1/N2/V1/V2, Raspberry
80- Pi 5).
81+ automatically. It uses Neon and
82+ SDOT on Arm.
8183
82- For Ubuntu/Debian distributions, install the C++ toolchain, then the Litespark-Inference Python package:
84+ Supported CPUs include:
85+
86+ - AWS Graviton 2, 3, or 4
87+ - Ampere
88+ - Neoverse N1, N2, V1, or V2
89+ - Raspberry Pi 5
90+
91+ For Ubuntu or Debian distributions, install the C++ toolchain, then the Litespark-Inference Python package:
8392
8493``` bash
8594sudo apt-get update
8695sudo apt-get install -y build-essential clang ninja-build git python3-pip
8796pip install litespark-inference
8897```
8998
90- For Red Hat, Fedora, or RHEL, install the toolchain with ` dnf ` instead:
99+ For Red Hat, Fedora, or RHEL, install the toolchain and package with ` dnf ` instead:
91100
92101``` console
93102sudo dnf install -y gcc-c++ clang ninja-build git python3-pip
@@ -100,7 +109,7 @@ Confirm the package imports and reports the kernel selected for your CPU:
100109python3 -c " import litespark_inference; print(litespark_inference.__version__)"
101110```
102111
103- The version is printed :
112+ The output is similar to :
104113
105114``` output
1061151.0.3
@@ -123,15 +132,14 @@ litespark_inference.torchless
123132 Accelerate: False
124133```
125134
126- ## How do I install Litespark-Inference on Apple silicon macOS?
135+ ## Install Litespark-Inference on Apple silicon macOS
127136
128- Apple's CPUs have NEON SDOT and Litespark-Inference uses it directly.
137+ Apple's CPUs have Neon SDOT, and Litespark-Inference uses it directly.
129138
130- The only extra step versus Linux is installing ` libomp ` , Apple's
131- toolchain does not ship a built-in OpenMP runtime, and Litespark uses
132- OpenMP for multi-threading inside the kernel.
139+ Litespark uses OpenMP for multi-threading inside the kernel. However, Apple's
140+ toolchain doesn't ship a built-in OpenMP runtime. To address this, you'll need to install ` libomp ` .
133141
134- Install Xcode command-line tools, the full Xcode is not required:
142+ Install Xcode command-line tools, ` libomp ` , and the Litespark-Inference Python package. The full set of Xcode tools isn't required:
135143
136144``` console
137145xcode-select --install
@@ -145,7 +153,7 @@ Verify the install:
145153python -m litespark_inference.torchless info
146154```
147155
148- The expected output includes :
156+ The output is similar to :
149157
150158``` output
151159litespark_inference.torchless
@@ -156,13 +164,13 @@ litespark_inference.torchless
156164 Accelerate: True
157165```
158166
159- If you see ` OpenMP : False ` , the build did not find Homebrew's ` libomp ` . The
167+ If you see ` OpenMP : False ` , the build didn't find Homebrew's ` libomp ` . The
160168most common cause is that Homebrew is installed under ` /opt/homebrew `
161- (the Apple Silicon default) but ` pip install ` ran in an environment that
169+ (the Apple silicon default), but ` pip install ` ran in an environment that
162170hides it. Re-run ` pip install litespark-inference ` from a normal
163171shell to fix it.
164172
165- ## How do I install from source?
173+ ## Install Litespark-Inference from source
166174
167175To modify the runtime or kernels, install from source instead of from
168176PyPI:
@@ -173,17 +181,20 @@ cd Litespark-Inference
173181pip install -e .
174182```
175183
176- ## Sanity-check
177-
178- On all platforms, the same command can be used.
184+ ## Verify the Litespark-Inference installation
179185
180- The first run downloads the model weights (around 4.5 GB into
181- ` ~/.cache/huggingface/hub ` ). Subsequent runs do not need to download
182- again.
186+ To verify that Litespark-Inference works as expected, run the following command:
183187
184188``` console
185189litespark-inference generate "Hello, world!" --max-tokens 16
186190```
191+ The same command works on both Linux and macOS.
192+
193+ {{% notice Note %}}
194+ The first run downloads the model weights, around 4.5 GB, into
195+ ` ~/.cache/huggingface/hub ` . Subsequent runs don't need to download
196+ again.
197+ {{% /notice %}}
187198
188199The output is similar to:
189200
@@ -200,6 +211,8 @@ Generated 9 tokens in 0.29s (31.58 tok/s)
200211Hello! How can I assist you today?
201212```
202213
214+ ## Next steps
215+
203216You are now ready to run BitNet-2B.
204217
205- Continue with [ Accelerate LLM inference on Arm CPUs with Litespark-Inference] ( /learning-paths/laptops-and-desktops/litespark-inference/ ) to learn more .
218+ To learn more, see the [ Accelerate LLM inference on Arm CPUs with Litespark-Inference] ( /learning-paths/laptops-and-desktops/litespark-inference/ ) Learning Path .
0 commit comments