Downloads · 30 days
175
10% of all-time downloads
amd/Kimi-K2-Thinking-W4A8
Kimi-K2-Thinking-W4A8 is a text generation model from amd. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as other.
- Model Architecture: Kimi-K2-Thinking - Input: Text - Output: Text - Supported Hardware Microarchitecture: AMD MI300/MI355 - ROCm: 7.0 - PyTorch: 2.8.0 - Transformers: 4.53.0 - Operating System(s): Linux - Inference…
Downloads · 30 days
175
10% of all-time downloads
All-time downloads
1.8K
Public
Repo size
532 GB
Likes
0
Public
Click a slice to open those files.
.safetensors532 GB · 100%
From the Hugging Face model README
This model was built with moonshotai Kimi-K2-Thinking model by applying AMD-Quark for INT4-FP8 quantization.
The model was quantized from moonshotai/Kimi-K2-Thinking using AMD-Quark.
#!/usr/bin/env python3
"""Kimi-K2-Thinking W4A8 re-quantization via AMD Quark (File-to-File Quantization)."""
import argparse
import os
from quark.torch.quantization.config.config import (
FP8E4M3PerTensorSpec, Int4PerChannelSpec, ProgressiveSpec,
QConfig, QLayerConfig,
)
from quark.torch.quantization.api import ModelQuantizer
def get_config():
exclude_layers = [
"*self_attn*", "*mlp.gate", "*lm_head",
"*mlp.gate_proj", "*mlp.up_proj", "*mlp.down_proj",
"*shared_experts*",
]
input_spec = FP8E4M3PerTensorSpec(
observer_method="min_max", scale_type="float32", is_dynamic=True,
).to_quantization_spec()
weight_spec = ProgressiveSpec(
first_stage=FP8E4M3PerTensorSpec(
observer_method="min_max", scale_type="float32", is_dynamic=False,
),
second_stage=Int4PerChannelSpec(
symmetric=True, scale_type="float32",
round_method="half_even", is_dynamic=False, ch_axis=0,
),
).to_quantization_spec()
return QConfig(
global_quant_config=QLayerConfig(input_tensors=input_spec, weight=weight_spec),
exclude=exclude_layers,
)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--model-path", type=str, required=True,
help="Path to moonshotai/Kimi-K2-Thinking checkpoint")
parser.add_argument("--export-path", type=str, required=True,
help="Path to save quantized output")
args = parser.parse_args()
quantizer = ModelQuantizer(get_config())
quantizer.direct_quantize_checkpoint(
pretrained_model_path=args.model_path,
save_path=args.export_path,
)
print("[INFO] Quantization completed")
This model can be deployed efficiently using the vLLM backends.
The model was evaluated on GSM8K benchmarks using the lm-evaluation-harness framework.
The results of GSM8K were obtained using lm-evaluation-harness and latest vLLM.
Launch vLLM
MODEL_DIR=/data/amd/Kimi-K2-Thinking-W4A8
VLLM_ATTENTION_BACKEND="TRITON_MLA" VLLM_ROCM_USE_AITER=1 VLLM_ROCM_USE_AITER_FUSION_SHARED_EXPERTS=0 VLLM_ROCM_USE_AITER_FP4BMM=0 vllm serve $MODEL_DIR \
--port 8001 \
--trust-remote-code \
--gpu-memory-utilization 0.9 \
--tensor-parallel-size 8
GSM8K evaluation
MODEL_ARGS="model=/data/amd/Kimi-K2-Thinking-W4A8,base_url=http://localhost:8001/v1/completions,num_concurrent=999999,timeout=999999,tokenized_requests=False,max_length=38768,temperature=0.6,top_p=0.95,add_bos_token=True,seed=$SEED,trust_remote_code=True"
lm_eval \
--model local-completions \
--model_args $MODEL_ARGS \
--tasks gsm8k \
--num_fewshot 8 \
--batch_size auto
Modifications Copyright(c) 2025 Advanced Micro Devices, Inc. All rights reserved.