Grok-1-FP8-KV

  • Introduction

    This model was created by applying Quark with calibration samples from Pile dataset.
  • Quantization Stragegy

    • Quantized Layers: All linear layers excluding "lm_head", "*gate"
    • Weight: FP8 symmetric per-tensor
    • Activation: FP8 symmetric per-tensor
    • KV Cache: FP8 symmetric per-tensor
  • Quick Start

  1. Download and install Quark
  2. Run the quantization script in the example folder using the following command line:
export MODEL_DIR = [local model checkpoint folder] or hpcai-tech/grok-1

python3 quantize_quark.py \
        --model_dir $MODEL_DIR \
        --output_dir Grok-1-FP8-KV \
        --quant_scheme w_fp8_a_fp8 \
        --kv_cache_dtype fp8 \
        --seq_len 2048 \
        --num_calib_data 128 \
        --model_export quark_safetensors \
        --multi_gpu \
        --no_weight_matrix_merge \
        --custom_mode fp8

Deployment

Quark has its own export format and allows FP8 quantized models to be efficiently deployed using the vLLM backend(vLLM-compatible).

Evaluation

Quark currently uses perplexity(PPL) as the evaluation metric for accuracy loss before and after quantization.The specific PPL algorithm can be referenced in the quantize_quark.py. The quantization evaluation results are conducted in pseudo-quantization mode, which may slightly differ from the actual quantized inference accuracy. These results are provided for reference only.

Evaluation scores

Benchmark hpcai-tech/Grok-1 (PyTorch Version) Grok-1-FP8-KV (this model)
Perplexity-wikitext2 3.2410 3.2739

License

Modifications copyright(c) 2024 Advanced Micro Devices,Inc. All rights reserved.

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.

Downloads last month
10
Safetensors
Model size
316B params
Tensor type
BF16
·
F8_E4M3
·
Inference API
Unable to determine this model's library. Check the docs .

Model tree for amd/grok-1-FP8-KV

Base model

hpcai-tech/grok-1
Quantized
(1)
this model

Collection including amd/grok-1-FP8-KV