Quark Quantization
conda create -y -n lora python=3.12
conda activate lora
Install PyTorch for your GPU:
# AMD GPUs (ROCm) β match your ROCm version:
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.1
Install AMD Quark + remaining deps. Download AMD Quark 0.11 (https://download.amd.com/opendownload/Quark/amd_quark-0.11.zip), unzip, and install the wheel from the extracted folder:
cd <extracted amd_quark-0.11>
pip install amd_quark-<version>.whl
pip install datasets transformers accelerate evaluate nltk peft trl pyyaml
Step 1 β Quantize the base (AMD Quark, INT4 AWQ)
Run from Quark's LLM PTQ example directory (inside the extracted archive). Qwen3 isn't in Quark's built-in AWQ registry, so a custom AWQ
config (qwen3_awq_config.json, cloned from the qwen2 template) is supplied.
cd <extracted amd_quark-0.11>/examples/torch/language_modeling/llm_ptq/
python quantize_quark.py \
--model_dir "Qwen/Qwen3-4B" \
--output_dir <repo>/models/quark-qwen3-4b-int4 \
--quant_scheme uint4_wo_128 \
--quant_algo awq \
--quant_algo_config_file awq <repo>/qwen3_awq_config.json \
--dataset pileval_for_awq_benchmark \
--model_export hf_format \
--data_type bfloat16 --exclude_layers []
License
Modifications copyright(c) 2025 Advanced Micro Devices, Inc. All rights reserved. AMD has modified the original model files for optimized deployment on AMD Ryzen AI hardware.
MIT License
Copyright (c) 2025 Advanced Micro Devices, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Base Model License
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
EULA & Third Party Notices
For the End User License Agreement (EULA) and Third Party Notices (TPN), see Ryzen AI Licenses.
- Downloads last month
- 14