mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-10 11:41:58 +08:00
- **Add SPDX license headers to python source files**
- **Check for SPDX headers using pre-commit**
commit 9d7ef44c3cfb72ca4c32e1c677d99259d10d4745
Author: Russell Bryant <rbryant@redhat.com>
Date: Fri Jan 31 14:18:24 2025 -0500
Add SPDX license headers to python source files
This commit adds SPDX license headers to python source files as
recommended to
the project by the Linux Foundation. These headers provide a concise way
that is
both human and machine readable for communicating license information
for each
source file. It helps avoid any ambiguity about the license of the code
and can
also be easily used by tools to help manage license compliance.
The Linux Foundation runs license scans against the codebase to help
ensure
we are in compliance with the licenses of the code we use, including
dependencies. Having these headers in place helps that tool do its job.
More information can be found on the SPDX site:
- https://spdx.dev/learn/handling-license-info/
Signed-off-by: Russell Bryant <rbryant@redhat.com>
commit 5a1cf1cb3b80759131c73f6a9dddebccac039dea
Author: Russell Bryant <rbryant@redhat.com>
Date: Fri Jan 31 14:36:32 2025 -0500
Check for SPDX headers using pre-commit
Signed-off-by: Russell Bryant <rbryant@redhat.com>
---------
Signed-off-by: Russell Bryant <rbryant@redhat.com>
100 lines
3.1 KiB
Python
100 lines
3.1 KiB
Python
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
import os
|
|
|
|
import torch
|
|
|
|
from tests.quantization.utils import is_quant_method_supported
|
|
from vllm import LLM, SamplingParams
|
|
from vllm.config import CompilationLevel
|
|
from vllm.platforms import current_platform
|
|
|
|
TEST_MODELS = [
|
|
("facebook/opt-125m", {}),
|
|
("nm-testing/tinyllama-oneshot-w8w8-test-static-shape-change", {
|
|
"dtype": torch.float16,
|
|
"quantization": "compressed-tensors"
|
|
}),
|
|
("neuralmagic/Meta-Llama-3-8B-Instruct-FP8", {
|
|
"dtype": torch.float16,
|
|
"quantization": "fp8"
|
|
}),
|
|
("nm-testing/Meta-Llama-3-8B-Instruct-W8A8-Dyn-Per-Token-2048-Samples", {
|
|
"quantization": "compressed-tensors"
|
|
}),
|
|
("meta-llama/Meta-Llama-3-8B", {}),
|
|
]
|
|
|
|
if is_quant_method_supported("aqlm"):
|
|
TEST_MODELS.append(("ISTA-DASLab/Llama-2-7b-AQLM-2Bit-1x16-hf", {
|
|
"quantization": "aqlm"
|
|
}))
|
|
|
|
# TODO: figure out why this fails.
|
|
if False and is_quant_method_supported("gguf"): # noqa: SIM223
|
|
TEST_MODELS.append(("TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF", {
|
|
"quantization": "gguf"
|
|
}))
|
|
|
|
if is_quant_method_supported("gptq"):
|
|
TEST_MODELS.append(("TheBloke/TinyLlama-1.1B-Chat-v0.3-GPTQ", {
|
|
"quantization": "gptq"
|
|
}))
|
|
|
|
if is_quant_method_supported("gptq_marlin"):
|
|
TEST_MODELS.append(("TheBloke/TinyLlama-1.1B-Chat-v1.0-GPTQ", {
|
|
"quantization": "gptq_marlin"
|
|
}))
|
|
|
|
if is_quant_method_supported("gptq_marlin_24"):
|
|
TEST_MODELS.append(("alexm-nm/tinyllama-24-marlin24-4bit-g128", {
|
|
"quantization": "gptq_marlin_24"
|
|
}))
|
|
|
|
if is_quant_method_supported("marlin"):
|
|
TEST_MODELS.append(("robertgshaw2/TinyLlama-1.1B-Chat-v1.0-g128-marlin", {
|
|
"quantization": "marlin"
|
|
}))
|
|
|
|
if not current_platform.is_rocm() and is_quant_method_supported("awq"):
|
|
TEST_MODELS.append(("TheBloke/TinyLlama-1.1B-Chat-v0.3-AWQ", {
|
|
"quantization": "AWQ"
|
|
}))
|
|
|
|
|
|
def check_full_graph_support(model,
|
|
model_kwargs,
|
|
optimization_level,
|
|
tp_size=1):
|
|
# make sure these models can be captured in full graph mode
|
|
os.environ["VLLM_TEST_DYNAMO_FULLGRAPH_CAPTURE"] = "1"
|
|
|
|
# The base meta llama uses too much memory.
|
|
if (model == "meta-llama/Meta-Llama-3-8B"
|
|
and optimization_level >= CompilationLevel.PIECEWISE):
|
|
return
|
|
|
|
print(f"MODEL={model}")
|
|
|
|
prompts = [
|
|
"Hello, my name is",
|
|
"The president of the United States is",
|
|
"The capital of France is",
|
|
"The future of AI is",
|
|
]
|
|
sampling_params = SamplingParams(temperature=0)
|
|
llm = LLM(model=model,
|
|
enforce_eager=True,
|
|
tensor_parallel_size=tp_size,
|
|
disable_custom_all_reduce=True,
|
|
compilation_config=optimization_level,
|
|
**model_kwargs)
|
|
|
|
outputs = llm.generate(prompts, sampling_params)
|
|
|
|
# Print the outputs.
|
|
for output in outputs:
|
|
prompt = output.prompt
|
|
generated_text = output.outputs[0].text
|
|
print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
|