This is vllm-compatible fp8 ptq model based on
Meta-Llama-3.1-405B-Instruct.
For detailed quantization scheme, refer to the official documentation of
AMD Quark 0.2.0 quantizer.
1docker build -f Dockerfile.rocm -t vllm_test .
2docker run --rm -it --device=/dev/kfd --device=/dev/dri --group-add video --ipc=host --shm-size 16G vllm_test:latest
1cp llama.json ~/models--meta-llama--Meta-Llama-3.1-405B-Instruct/snapshots/069992c75aed59df00ec06c17177e76c63296a26/.
2cp llama.safetensors ~/models--meta-llama--Meta-Llama-3.1-405B-Instruct/snapshots/069992c75aed59df00ec06c17177e76c63296a26/.
1# 8 GPUs
2torchrun --standalone --nproc_per_node=8 run_vllm_fp8.py
1# run_vllm_fp8.py
2from vllm import LLM, SamplingParams
3prompt = "Write me an essay about bear and knight"
4
5model_name="models--meta-llama--Meta-Llama-3.1-405B-Instruct/snapshots/069992c75aed59df00ec06c17177e76c63296a26/"
6tp=8 # 8 GPUs
7
8model = LLM(model=model_name, tensor_parallel_size=tp, max_model_len=8192, trust_remote_code=True, dtype="float16", quantization="fp8", quantized_weights_path="/llama.safetensors")
9sampling_params = SamplingParams(
10 top_k=1.0,
11 ignore_eos=True,
12 max_tokens=200,
13 )
14result = model.generate(prompt, sampling_params=sampling_params)
15print(result)
1# 8 GPUs
2torchrun --standalone --nproc_per_node=8 run_vllm_fp16.py
1# run_vllm_fp16.py
2from vllm import LLM, SamplingParams
3prompt = "Write me an essay about bear and knight"
4
5model_name="models--meta-llama--Meta-Llama-3.1-405B-Instruct/snapshots/069992c75aed59df00ec06c17177e76c63296a26/"
6tp=8 # 8 GPUs
7model = LLM(model=model_name, tensor_parallel_size=tp, max_model_len=8192, trust_remote_code=True, dtype="bfloat16")
8sampling_params = SamplingParams(
9 top_k=1.0,
10 ignore_eos=True,
11 max_tokens=200,
12 )
13result = model.generate(prompt, sampling_params=sampling_params)
14print(result)
Will update soon.
Copyright (c) 2018-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
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.