Installation Guide#
Recommended First Time User Installation#
If this is your first time setting up Quark, and want to try it out, this section will get you set up quickly with something that will run on a laptop without a GPU. When you are comfortable with the basic concepts you can come back to the following sections on this page for more advanced set up options.
The suggested installation of AMD Quark is in a Python environment such as Miniconda. You can then create an environment for Quark and its dependencies with:
conda create -n AMD_Quark python=3.11
conda activate AMD_Quark
You may then use pip
to install Quark from PyPI, and all dependencies.
Note
On Windows it is common for developers to use a Linux environment with WSL, such as installing Ubuntu via the Microsoft Store. In that case Linux installation instructions apply, and Miniconda is installed on Ubuntu. We suggest you do this for your first installation of Quark. It is also possible to install Quark natively on Windows. To do so, make sure to install the required dependencies as outlined in Prerequisites.
Check your python installation is version 3.11 with python --version
, e.g. Python 3.11.11
, which is fine. Refer to Prerequisites below to learn more about the supported Python versions.
Next we will install PyTorch. We’ve selected the CPU wheel of PyTorch here so that Quark will run on laptops without GPUs, which is slower, but fine for trying out Quark.
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
We also need to install a C++ compiler for ONNX, such as g++
. In an Ubuntu environment you can install that with:
sudo apt install build-essential
That’s it! You should now be able to move on to the Basic Usage guides in the side bar to try different workflows in Quark. You can return to this guide later when you’d like to try a more advanced set up, for example, a new conda environment with a PyTorch wheel supporting your GPU.
Prerequisites#
Python 3.9, 3.10, 3.11 or 3.12 is required. Python 3.13. is currently not supported by Quark’s dependencies.
- Install PyTorch for your compute platform (such as CUDA, ROCm, and CPU).
Only select PyTorch version 2.2.0 or later.
- Quark has the following dependencies, which are installed automatically with
pip
and wheel installs of Quark. ONNX version 1.16.0 or later.
ONNX Runtime version 1.17.0 or later, but earlier than or equal to 1.20.1.
onnxruntime-extensions version 0.4.2 or later.
- Quark has the following dependencies, which are installed automatically with
- Install a C++ compiler.
On Ubuntu the
g++
compiler is installed with thebuild-essential
package. Note that whilst many versions of C++ compiler may work, we currently only confirm support for g++ version 13.3, which installs with thebuild-essential
package on Ubuntu 24.04.- When installing natively on Microsoft Windows, Visual Studio is necessary, with Visual Studio 2022 being the minimum required version. During the compilation process, you can choose one of the following methods:
Use the Developer Command Prompt for Visual Studio. When installing Visual Studio, ensure that you include the Developer Command Prompt. You can access it through Visual Studio by clicking Tools > Command Line > Developer Command Line. You can execute the programs in the CMD window of the Developer Command Prompt for Visual Studio.
Manually add paths to the environment variables. The tools
cl.exe
,MSBuild.exe
, andlink.exe
from Visual Studio are used. Ensure that their paths are included in thePATH
environment variable. These programs can be found in the Visual Studio installation directory. In the Edit Environment Variables window, click New, and then paste the path to the folder containing thecl.exe
,link.exe
, andMSBuild.exe
files. Click OK on all of the windows to apply the changes.
Installation#
Note
The AMD Quark package distribution name has been renamed to amd-quark
. Please use the new package name for releases newer than 0.6.0.
We recommend new users install Quark from PyPI with pip
. It’s also possible to install from a ZIP download.
Install from PyPI with Pip#
Releases of AMD Quark are available on PyPI https://pypi.org/project/amd-quark/, and can be installed with pip
:
pip install amd-quark
Nightly builds are not yet available on PyPI.
Install from ZIP Download#
Step 1: Download and unzip 📥*amd_quark-*.zip* which has a wheel package in it. You can download wheel package 📥*amd_quark-*.whl* directly.
📥amd_quark.zip release_version (recommend)
📥amd_quark.whl release_version
Directory Structure of the zip file:
+ amd_quark.zip + amd_quark.whl + examples # Examples code of Quark + docs # Off-line documentation of Quark. + README.mdWe strongly recommend downloading the zip file, as it includes examples compatible with the wheel package version.
Step 2: Install the quark wheel package by running the following command:
pip install amd_quark*.whl
Installation Verification#
(Optional) Verify the installation by running
python -c "import quark"
. If no error is reported, the installation is successful.(Optional) Compile the
fast quantization kernels
. When using Quark’s quantization APIs for the first time, it compiles thefast quantization kernels
using your installed Torch and CUDA, if available. This process might take a few minutes, but the subsequent quantization calls are much faster. To invoke this compilation now and check if it is successful, run the following command:python -c "import quark.torch.kernel"
Note
For Quark with GPU on windows, if the kernel cannot be loaded successfully, please follow the steps below to troubleshoot
Ensure c++ compiler is install.
Ensure that
torch.cuda.is_available()
returnsTrue
.Verify that
nvcc
orhipcc
can be invoked from the command line.If the compilation is successful but Python fails to load the DLL, locate the Quark build directory (the build path will be printed in the log) and check the dependencies using:
dumpbin /DEPENDENTS kernel_ext.pyd
A common issue is that the required DLL is not included in the system path or the version of the dependent DLL is incorrect.
(Optional) Compile the
custom operators library
. When using Quark-ONNX’s custom operators for the first time, it compiles thecustom operators library
using your local environment. To invoke this compilation now and check if it is successful, run the following command:python -c "import quark.onnx.operators.custom_ops"
Older Versions#
Note: The following links are for older versions of AMD Quark, before the package distribution name was renamed to amd-quark
.
quark_0.8 (coming soon)